UVa 11462 Age Sort】的更多相关文章

Age Sort You are given the ages (in years) of all people of a country with at least 1 year of age. You know that no individual in that country lives for 100 or more years. Now, you are given a very simple task of sorting all the ages in ascending ord…
解题报告:给若干个居民的年龄排序,年龄的范围在1到100之间,输入的总人数在0到200W.这题要注意的输入的文件约有25MB,而内存限制为2MB,所以如果人数是像200W这样多的话,甚至都不能把它们都读入内存,所以就不能用快速排序等各种排序,只能通过标记来进行排序,这题很明显的一个特征就是要排序的数字都不大,只有1到100,要排序的数字的个数大于要排序的数字的范围,所以我们可以定义一个数组age[105],然后将他各个都初始化为0,若输入了一个数,则将以这个数为下标的上标相应的加1,表示年龄是这…
You are given the ages (in years) of all people of a country with at least 1 year of age. You know that no individual in that country lives for 100 or more years. Now, you are given a very simple task of sorting all the ages in ascending order. Input…
内存不够用,用计数排序可以解决问题. #include<iostream> #include<cstdio> #include<cstdlib> #include<cstring> #include<string> #include<cmath> #include<map> #include<set> #include<vector> #include<list> #include<…
★   输入文件:AgeSort.in   输出文件:AgeSort.out   简单对比时间限制:1 s   内存限制:2 MB [题目描述] Mr.Zero(CH)喜闻乐见地得到了一台内存大大增强的 OI型 Apple Ⅱ,可以运行C,C++,和Pascal!为了炫耀这台高端的计算机,Mr.Zero决心将邻居们的年龄(0≤Age[i]≤120)统计后进行统计.但是,古董终究是古董,Mr.Zero拥有最多n个邻居(n≤2,400,000)但是计算机所能运行程序时的内存限制竟然达到了2MB.请你…
例题17  年龄排序(Age Sort, UVa 11462)照从小到大的顺序输出. [输入格式] 输入包含多组测试数据.每组数据的第一行为整数n(0<n≤2 000 000),即居民总数:下一行包含n个不小于1.不大于100的整数,即各居民的年龄.输入结束标志为n=0. 输入文件约有25MB,而内存限制只有2MB. [输出格式] 对于每组数据,按照从小到大的顺序输出各居民的年龄,相邻年龄用单个空格隔开. 效率对比: 输入输出挂 inline int readint() { char c = g…
B Age Sort Input: Standard Input Output: Standard Output   You are given the ages (in years) of all people of a country with at least 1 year of age. You know that no individual in that country lives for 100 or more years. Now, you are given a very si…
题 题意 给你最多2000000个数据,大小是1到99的数,让你排序输出. 分析 快排也可以过.不过这题本意是要基数排序(桶排序),就是读入年龄age, a[age]++,然后输出时,从1到99岁(看清范围,我看成1到100了TAT)有几个就输出几次.这题还有注意格式,最后不要空格,然后换行. 代码 #include<cstdio> #include<cstring> int n,a[100],age,ok; int main() { while(scanf("%d&qu…
                                       Silly Sort Your younger brother has an assignment and needs some help. His teacher gave him a sequence ofnumbers to be sorted in ascending order. During the sorting process, the places of two numbers can beinter…
题号:a001: 哈囉 背景知识:输出语句,while not eof 题号:a002: 簡易加法 背景知识:输出语句,while not eof,加法运算 题号:a003: 兩光法師占卜術 背景知识:while not eof,分支语句,求余 PS:%表示求余 题号:a004: 文文的求婚 背景知识:while not eof,分支语句,判断闰年 题号:a005: Eva 的回家作業 背景知识:循环,if语句,等比数列,等差数列,输出语句 题号:a006: 一元二次方程式 背景知识:if语句的…