cconst int maxn = 110; int n; int cnt[maxn]; int main() { int temp; while(scanf("%d", &n) == 1 && n) { memset(cnt, 0, sizeof(cnt)); for(int i = 0; i < n;i ++) { scanf("%d", &temp); cnt[temp]++; } for(int i = 1; i < 100; i++) { for(int j =...
UVa 11462 - Age Sort (桶排序) 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 simple...
Uva_11462 GCD - Extreme (II) 题目链接 题意: 给定一个n, 求:GCD(1, 2) + GCD(1, 3) + GCD(2, 3) + …… + GCD(1, n) + GCD(2, n) + …… + GCD(n-1, n); 设f(n) = ΣGCD(i, n), i = 1, 2, 3, ... , n-1 本题即求:f(2) + f(3) + f(4) + ... ...
( 设计高效算法 ) 年龄排序 Age Sort Uva 11462 ( 设计高效算法 ) 年龄排序 Age Sort Uva 11462 可以使用整数排序法, 内存太小无法堆排序. 优化输入输出也可以提高效率, 但是这个是最后考虑的优化要素. 函数名前 的inline 相当于c的宏定义, 降低大量函数引用消耗的时间. 使用cctype 中的 isdigit posted on ...
UVA - 11462 Age Sort 题目大意:给定若干居民的年龄(1到100之间的整数),把他们从小到大的顺序输出 解题思路:用一个数组记录每个整数出现的次数,然后再输出 AI检测代码解析 #include<algorithm> #include<cstdio> #include<cstring> using namespace std;...
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 ...
这题要注意的输入的文件约有25MB,而内存限制为2MB,所以如果人数是像200W这样多的话,甚至都不能把它们都读入内存,所以就不能用快速排序等各种排序,只能通过标记来进行排序,这题很明显的一个特征就是要排序的数字都不大,只有1到100,要排序的数字的个数大于要排序的数字的范围,所以我们可以定义一个数组age[105],...
点击打开链接uva 11462 水题 #include<cstdio> #include<cstring> #include<iostream> #include<algorithm> using namespace std; const int maxn = 2000010; int num[maxn]; int n; int main(){ while(scanf("%d" , &n) && n){ for(int i = 0 ; i < n ; i++) ...
UVa 11462 - Age Sort/src Commit for the initial 23 problems solved Jan 4, 2013 UVa 11498 - Division of Nlogonia/src Commit for the initial 23 problems solved Jan 4, 2013 UVa 11503 - Virtual Friends/src UVa 11503 Mar 15, 2013 UVa 11506 - Angry Programmer/src UVa 11506 Mar 11, 2013...
11462 replace *os.File with io.Reader, io.Writer, io.ReadCloser or io.Write… Mar 10, 2018 11466 UVa 11466 - Largest Prime Divisor Nov 5, 2017 11470 UVa 11470 - Square Sums Aug 23, 2017 11479 UVa 10954 - Add All Jul 8, 2016 11494 UVa 11494 - Queen Apr 4, 2017 11498 code clean...