hdu 4726(贪心)】的更多相关文章

Kia's Calculation Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 3291    Accepted Submission(s): 703 Problem Description Doctor Ghee is teaching Kia how to calculate the sum of two integers. Bu…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4726 题意:给出两个n位的数字,均无前缀0.重新排列两个数字中的各个数,重新排列后也无前缀0.得到的两个新数相加和最大.这里的相加是无进位的相加.输出结果.输出时不要输出前缀0. 思路:答案的第一位比较特殊,相加的两个数中不能有0.可以枚举这个答案中的第一个数字,查找是否存在两个数相加为这个数字.后面的道理一样,也是枚举. int a[2][10]; int n; char s[2][N]; int…
Kia's Calculation Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 513 Accepted Submission(s): 142 Problem Description Doctor Ghee is teaching Kia how to calculate the sum of two integers. But Kia…
Kia's Calculation Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 83    Accepted Submission(s): 16 Problem Description Doctor Ghee is teaching Kia how to calculate the sum of two integers. But K…
DescriptionDoctor Ghee is teaching Kia how to calculate the sum of two integers. But Kia is so careless and alway forget to carry a number when the sum of two digits exceeds 9. For example, when she calculates 4567+5789, she will get 9246, and for 12…
题目: http://acm.hdu.edu.cn/showproblem.php?pid=5289 Assignment Time Limit: 4000/2000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 3175    Accepted Submission(s): 1457 Problem Description Tom owns a company and he i…
http://acm.hdu.edu.cn/showproblem.php?pid=4803 话说C++还卡精度么?  G++  AC  C++ WA 我自己的贪心策略错了 -- 就是尽量下键,然后上键,最后下键补全,可是例子都过不了..... 题解參考http://www.cnblogs.com/xuesu/p/3967704.html http://www.cnblogs.com/Canon-CSU/p/3451784.html http://blog.csdn.net/keshuai199…
戳我穿越:http://acm.hdu.edu.cn/showproblem.php?pid=1735 对于贪心,二分,枚举等基础一定要掌握的很牢,要一步一个脚印走踏实 这是道贪心的题目,要有贪心的意识. 首先将所有为0的地方统计,因为是求最小的字数,所有最后一行后面的0可以看为空格直接减掉, 因为有m段(一定包括第一行),再减去m*2,最后枚举每行,将至少前两个为0的上一行的最后有多少 的0统计起来排序,再依次减去前m-1个大的,这样就保证了得到的答案是符合条件中最小的 code #inclu…
http://acm.hdu.edu.cn/showproblem.php?pid=4974 n个人进行选秀,有一个人做裁判,每次有两人进行对决,裁判可以选择为两人打分,可以同时加上1分,或者单独为一个人加分,或者都不加.给出最后的比分情况,问说最少要比多少次才能获得现在的得分状态. 直接贪心模拟,或者推出结论为(sum + 1) / 2和ai最大值的最大值 #include <cstdio> #include <cstdlib> #include <cmath> #i…
http://acm.hdu.edu.cn/showproblem.php?pid=4982 给定n和k,求一个包含k个不相同正整数的集合,要求元素之和为n,并且其中k-1的元素的和为完全平方数 枚举平方数,从1开始构造余下序列(贪心),需要特判最后剩下的一个数是否在之前的序列或者和n-m*m相同,然后就是++--不断判断能否返回true or false #include <cstdio> #include <cstdlib> #include <cmath> #in…