Wuhan University of Science and Technology acm:1008: Random number of the Ming

Source: Internet
Author: User
Tags ming

Problem 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.

Input

The input has 2 rows, and the 1th behavior is 1 positive integers, indicating the number of random numbers generated:

N

The 2nd line has n spaces separated by a positive integer, which is the resulting random number.

Output

The output is also 2 lines, and the 1th behavior is 1 positive integer m, which represents the number of different random numbers. The 2nd behavior is a positive integer separated by a space, which is a different random number from small to large sequence.

Sample Input
1020 40 32 67 40 20 89 300 400 15
Sample Output
815 20 32 40 67 89 300 400
HINT
1#include <iostream>2 using namespacestd;3 4 intMain ()5 {6     7     intnum,i;8      while(Cin >>num)9     {Ten         intentry[ +] = {0}; One         intRandomnum =0; A          for(i =0; i < num; i++) -         {    -CIN >>Randomnum; theEntry[randomnum] =1; -         } -          -         intCount =0; +          for(i =0; I < +; i++) -         { +             if(Entry[i]! =0) A             { atcount++;//record the number of non-0 in the array -             } -         } -num =count; -cout << Num <<Endl; -Count =0; in          for(inti =0; I < +; i++) -         { to             if(Entry[i]! =0) +             { -cout <<i; thecount++; *                 if(Count! =num) $                 {Panax Notoginsengcout <<" "; -                 } the                 Else +                 { Acout <<Endl; the                 } +             } -         } $     } $     return 0; -}

Wuhan University of Science and Technology acm:1008: Random number of the Ming

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.