HDU 1002 A + B Problem II(AC代码)】的更多相关文章

数字的反转: 就是将数字倒着存下来而已.(*^__^*) 嘻嘻…… 大致思路:将数字一位一位取出来,存在一个数组里面,然后再将其变成数字,输出. 详见代码. while (a) //将每位数字取出来,取完为止 { num1[i]=a%; //将每一个各位取出存在数组里面,实现了将数字反转 i++; //数组的变化 a/=; } 趁热打铁 例题:hdu 4554 叛逆的小明 题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4554 叛逆的小明 Time…
A + B Problem II Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 347161    Accepted Submission(s): 67385 Problem Description I have a very simple problem for you. Given two integers A and B, you…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1002 Problem DescriptionI have a very simple problem for you. Given two integers A and B, your job is to calculate the Sum of A + B. InputThe first line of the input contains an integer T(1<=T<=20) whic…
题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=1002 题意: 数学题,A+B; 思路,这个数非常大,普通加法一定会超时,所以用大数加法.大数加法的基本思路是模拟我们做加法的时候的进位思想,从最低位开始模拟, 在我的代码里 v -- 进位, tmp -- 当前位2个数的和,k -- 答案数组的下标. 其中, tmp/10 可以得到要进的位数, 同理,tmp%10可以得到个位,就是答案数组对应的位 下面是AC代码: #include <iostre…
A + B Problem II Time Limit:1000MS     Memory Limit:32768KB     64bit IO Format:%I64d & %I64u Description I have a very simple problem for you. Given two integers A and B, your job is to calculate the Sum of A + B.    Input The first line of the inpu…
A + B Problem II   Time Limit: 1000MS      Memory Limit: 65536K Total Submissions: 16104    Accepted: 4547 Description I have a very simple problem for you. Given two integers A and B, your job is to calculate the Sum of A + B. Input The first line o…
#include <stdio.h> #include <string.h> #define MAX 1009 int main() { },b[MAX]={}; ,z=,r=,k=; char *p=NULL; scanf("%d",&n); <n&&n< ){ ;i<n;i++){ j=; z=; r=; scanf("%s",a); scanf("%s",b); printf…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1002 题目意思:就是大整数加法. 两年几前做的,纯粹是整理下来的. #include <stdio.h> #include <string.h> #define max 1010 char a[max], b[max]; int main() { int i, k, s, c, T, len1, len2; scanf("%d", &T); ; k <…
题目链接 Problem Description I have a very simple problem for you. Given two integers A and B, your job is to calculate the Sum of A + B.   Input The first line of the input contains an integer T(1<=T<=20) which means the number of test cases. Then T li…
题意:就是求a+b (a,b都不超过1000位) 思路:用数组存储 第一道大数的题目,虽然很水,纪念一下! 代码: #include<cstdio> #include<cstring> int main(){ int t,lena,lenb,i,j,sum,testcase=0; char a[1024],b[1024]; char c[1024];//存 a+b int co;//进位 scanf("%d",&t); int tt=t; while(t…