K - Kia's Calculation(贪心)】的更多相关文章

Kia's Calculation Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 3902    Accepted Submission(s): 784 Problem Description Doctor Ghee is teaching Kia how to calculate the sum of two integers. Bu…
Kia's Calculation Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Problem Description Doctor Ghee is teaching Kia how to calculate the sum of two integers. But Kia is so careless and alway forget to carry a number…
题目链接:http://acm.hdu.edu.cn/userstatus.php?user=zhsl 题意:给两个大数,他们之间的加法法则每位相加不进位.现在可以对两个大数的每位重新排序,但是首位不能为0,求两个数相加最大的和. 从最高位开始,考虑和最大贪心,每次从两个大数中找两位a和b,max=(a+b)%10的和最大.如果max有多种组成情况,对于a+b<10的所有情况,我们任意选择一组就可以了.对于存在a'+b'>10的组合情况,如果有a+b<10的组合情况,我们就选择a+b&l…
题目传送门 /* 这题交给队友做,做了一个多小时,全排列,RE数组越界,赛后发现读题读错了,囧! 贪心:先确定最高位的数字,然后用贪心的方法,越高位数字越大 注意:1. Both A and B will have same number of digits 两个数字位数相同 2. which is no larger than 10^6 不是大小,而是长度不超过1e6 */ #include <cstdio> #include <iostream> #include <al…
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…
Kia's Calculation Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 1367    Accepted Submission(s): 327 Problem Description Doctor Ghee is teaching Kia how to calculate the sum of two integers. Bu…
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=4726 题意:给出两个n位的数字,均无前缀0.重新排列两个数字中的各个数,重新排列后也无前缀0.得到的两个新数相加和最大.这里的相加是无进位的相加.输出结果.输出时不要输出前缀0. 思路:答案的第一位比较特殊,相加的两个数中不能有0.可以枚举这个答案中的第一个数字,查找是否存在两个数相加为这个数字.后面的道理一样,也是枚举. int a[2][10]; int n; char s[2][N]; int…
Problem Description Doctor 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, a…