Title Description
Description
Obviously want to ask some students in school to do a questionnaire survey, in order to the objectivity of the experiment, he first used a computer to generate N 1 to 1000 random integer (n≤100), for the repeated numbers, only one, the rest of the same number is removed, the different numbers correspond to different student's number. Then the numbers from small to large sorting, in line with the order to find students to do the investigation. Please help clearly to complete the "go to Heavy" and "sort" work.
Enter a description
Input Description
There are 2 rows, and the 1th behavior is 1 positive integers representing the number of N of the generated random number:
The 2nd line has n spaces separated by a positive integer, for the resulting random number
Output description
Output Description
The 1th behavior is 1 positive integer m, which represents the number of different random numbers. The 2nd behavior m a positive integer separated by a space, for small
To a large sequence of different random numbers.
Sample input
Sample Input
10
20 40 32 67 40 20 89 300 400 15
Sample output
Sample Output
8
15 20 32 40 67 89 300 400
Data range and Tips
Data Size & Hint
Exercises
Sort.
You can use a bucket, or you can use the selection, but I used a bucket (lazy).
var n,i,s,ans:longint;
A:array[0..1001]of Boolean;
Begin
READLN (n);
For I:=1 to N do
Begin
Read (s);
A[s]:=true;
End
For I:=1 to Ans:=ans+ord (A[i]);
Writeln (ANS);
For I:=1 to
If A[i] then write (i, ");
End.
2006 the random number of the Ming