题目链接: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…
贪心 不是很难 各种细节注意 #include <cstdio> #include <cstring> #include <algorithm> using namespace std; int num1[10],num2[10]; int cc(int i, int j) { for(int k = 0; k <= 9; k++) { if( (k+i)%10 == j ) return k; } return 0; } int main() { int t,…
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): 3291 Accepted Submission(s): 703 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…
Saving HDU Time Limit: 3000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 7194 Accepted Submission(s): 3345 Problem Description 话说上回讲到海东集团面临内外交困,公司的元老也只剩下XHD夫妇二人了.显然,作为多年拼搏的商人,XHD不会坐以待毙的. 一天,当他正在苦思冥想解困良策的…
http://acm.hdu.edu.cn/showproblem.php?pid=3037 Lucas定理模板. 现在才写,noip滚粗前兆QAQ #include<cstdio> #include<cstring> #include<algorithm> using namespace std; typedef long long ll; int jc[100003]; int p; int ipow(int x, int b) { ll t = 1, w = x;…