★ 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]