-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path11462.cpp
More file actions
38 lines (36 loc) · 781 Bytes
/
Copy path11462.cpp
File metadata and controls
38 lines (36 loc) · 781 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
#include <bits/stdc++.h>
int a[2000001];
int compare_ints(const void* a, const void* b) // comparison function
{
int* arg1 = (int*)a;
int* arg2 = (int*)b;
if (*arg1 < *arg2)
return -1;
else if (*arg1 == *arg2)
return 0;
else
return 1;
}
int main() {
int i, j, n, size;
while (scanf("%d", &n)) {
if (n == 0) {
break;
}
j = 0;
for (i = 0; i < n; i++) {
scanf("%d", &a[i]);
}
size = n;
std::qsort(a, size, sizeof(int), compare_ints);
for (int i = 0; i < size; i++) {
if (j != 0) {
printf(" ");
}
printf("%d", a[i]);
j = 1;
}
printf("\n");
}
return 0;
}