Nyoj 48 survey of Xiao Ming's work

Source: Internet
Author: User

The time limit of Xiao Ming's investigation work: +Ms | Memory Limit:65535KB Difficulty:1
Describe
Xiao Ming's teacher assigned a survey homework, Xiao Ming want to ask some students in school to do a questionnaire survey, bright Xiaoming for the objectivity of the experiment, want to use their computer knowledge to help themselves. He first used the computer to generate N 1 to 1000 random integer (0<n≤1000), for the number of repetitions, only one, the remaining same number of the same, 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
input has 2 rows, the 1th behavior 1 positive integers, indicating the number of random numbers generated:
N
2nd row has N spaces separated by a positive integer, the resulting random number. The
output
output is also 2 rows, 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-All-in-a-page 
Example Output
815-All-in-a-box 
 
 #include <stdio.h> int main () {int i,j,n,sum=0,x[1001]={0}; scanf ("%d", &n); for (i=1;i<=n;i++) {SC ANF ("%d", &j); if (x[j]==0) sum++;x[j]=1; } printf ("%d\n", sum);  for (i=1;i<=1000;i++) if (x[i]==1) printf ("%d", I);//There is a sort function. return 0; } 

Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

Nyoj 48 survey of Xiao Ming's work

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.