#P1059. [NOIP 2006 普及组] 明明的随机数
[NOIP 2006 普及组] 明明的随机数
Description
Mingming wants to invite some classmates at school to fill out a questionnaire. For objectivity, he first uses a computer to generate random integers between and (). For any duplicates, keep exactly one occurrence and remove the rest; different numbers correspond to different students' ID numbers. Then sort these numbers in ascending order, and visit the classmates in the sorted order. Please help Mingming remove duplicates and sort the numbers.
Input Format
The input has two lines.
The first line contains a positive integer, the number of generated random integers.
The second line contains positive integers separated by spaces, which are the generated random integers.
Output Format
The output also has two lines.
The first line contains a positive integer , the number of distinct random integers.
The second line contains positive integers separated by spaces, which are the distinct random integers in ascending order.
10
20 40 32 67 40 20 89 300 400 15
8
15 20 32 40 67 89 300 400
Hint
NOIP 2006 Junior, Problem 1.
Translated by ChatGPT 5
京公网安备 11011102002149号