Topic 1202: Sorting
time limit:1 seconds memory limit:32 trillion special question: No
Title Description:
Sorts and outputs the n number of inputs.
-
Input:
- The first line of input includes an integer n (1<=n<=100).
- The next line consists of n integers.
-
Output:
- There may be multiple sets of test data, and for each set of data, the sorted n integers are output, followed by a space after each number.
- The result of each set of test data is one row.
-
Sample input:
- 4
- 1 4 3 2
-
Sample output:
- 1 2 3 4
1#include <stdio.h>2 3 intMainintargcConst Char*argv[])4 {5 intN,i =0, j =0;6 inta[ -] = {0};7 8 while(SCANF ("%d", &n)! =EOF)9 {Ten for(i =0; I < n;i++) One { Ascanf"%d",&a[i]); - } - the for(i =0; I < n; i++) - { - for(j =0; J < N-1I J + +) - { + if(A[j] > a[j +1]) - { +A[J] ^= A[j +1]; AA[j +1] ^=A[j]; atA[J] ^= A[j +1]; - } - } - } - - for(i =0; I < n; i++) in { -printf"%d", A[i]); to } + -Putchar ('\ n'); the } * $ return 0;Panax Notoginseng}
Topic 1202: Sorting