-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path1079.cpp
More file actions
46 lines (41 loc) · 787 Bytes
/
Copy path1079.cpp
File metadata and controls
46 lines (41 loc) · 787 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#include <stdio.h>
const int N = 1 << 29;
int a[15], min1, max1, b, k;
void make() {
for ( int i = 0; i < 10; i ++ ) {
if ( a[i] < min1 ) {
b = i;
min1 = a[i];
}
}
int temp;
temp = a[b];
a[b] = a[0];
a[0] = temp;
for ( int i = 0; i < 10; i ++ ) {
if ( a[i] > max1 ) {
k = i;
max1 = a[i];
}
}
temp = a[k];
a[k] = a[9];
a[9] = temp;
}
void print() {
int i;
for ( i = 0; i < 10; i ++ ) {
printf("%d ", a[i]);
}
printf("\n");
}
int main() {
scanf("%d", &a[0]);
min1 = N;
max1 = - N;
for ( int i = 1; i < 10; i ++ ) {
scanf("%d", &a[i]);
}
make();
print();
}