COGS 1406. Neighborhood Age Sort [ages Sort,uva 11462]

Source: Internet
Author: User

★ Input File: AgeSort.in output file: AgeSort.out Simple comparison
Time limit: 1 s memory limit: 2 MB

"Title description"

Mr.zero (CH) loved to get a memory greatly enhanced Oi type Appleⅱ, can run c,c++, and pascal! To show off this high-end computer, Mr.zero is determined to count the neighbors ' age (0≤age[i]≤120). However, antiques are antiques, mr.zero have up to n neighbors (n≤2,400,000) but the computer can run the program when the memory limit is reached 2MB. Ask you to help him design sort his stats.

"Input Format"

A line of integers that represents the age of each neighbor

"Output Format"

A line of integers, sorted by age;

"Sample Input"
"Sample Output"
1 5 9 25 36 50

Source

(Age Sort,uva 11462) [Data source, Algorithms Consult,chen Hao]

Bucket row

Dragon Slayer Blades click on Send

#include <cstdio>intn,age[121];intA;intMain () {Freopen ("agesort.in","R", stdin); Freopen ("Agesort.out","W", stdout);  while(SCANF ("%d", &a)!=eof) age[a]++;  for(intI=0; i<= -; i++)    {        if(Age[i]) while(age[i]--) printf ("#df", i); }    return 0;}

COGS 1406. Neighborhood Age Sort [ages Sort,uva 11462]

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.