Kia's Calculation hdu4726】的更多相关文章

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…
题目传送门 /* 这题交给队友做,做了一个多小时,全排列,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): 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)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) 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…
题目的意思是给你两个数字(多达10^6位) 做加法,但是有一点,没有进位(进位不算,相当于这一位相加后对10取模) 你可以任意排列两个数字中的每一位,但是不能是0开头. 现在题目要求以这种不进位的算法计算得到的最大值是多少? 看完题目就会知道,这个题目一定不是dp,或者说根本不是什么高端的算法,那是什么呢? 对,你没有猜错——贪心. 为什么可以用贪心呢?我们比较一个数,都是从高位的先比较,所以只要高位的大,这个数就大:于是我们要得到最大的和,就要先统计能够构成多少个9,多少个8……(有大的就先构…
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…
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…