HDU 1002 A+B problemII
来源:互联网 发布:淘宝推广招聘要求 编辑:程序博客网 时间:2024/06/05 23:41
#include<stdio.h>#include<string.h>const int maxn=1000;char f1[maxn],f2[maxn];int f3[maxn];int main(){ int n,l1,l2; while(scanf("%d",&n)==1){ for(int h=0;h<n;h++){ scanf("%s%s",f1,f2); int i,j,k,s=0,c=0; l1=strlen(f1); l2=strlen(f2); for(i=l1-1,j=l2-1,k=0;i>=0&&j>=0;i--,j--,k++){ s=f1[i]-48+f2[j]-48+c; f3[k]=s%10; c=s/10; } if(i>0){ while(i>=0){ s=f1[i]-48+c; f3[k]=s%10; c=s/10; i--;k++; } } else if(j>0){ while(j>=0){ s=f2[j]-48+c; f3[k]=s%10; c=s/10; j--;k++; } } if(c){ f3[k]=c; k+=1; } printf("Case %d:\n",h+1); printf("%s + %s = ",f1,f2); for(i=k-1;i>=0;i--){ printf("%d",f3[i]); } if(h+1<n) printf("\n\n"); else printf("\n"); } } return 0;}
0 0
- HDU 1002 A+B problemII
- [hdu-1002] (A+B)problemII
- HDU 1002 A+B problemII
- HDU 1002 -- A+B problemII (Java)
- 杭电ACM----------1002 A+B problemII
- nyoj103 A+B ProblemII
- NYOJ 623 A*B ProblemII
- 杭电ACM-HDU1002-A+B ProblemII
- HDU 1023 Train ProblemII
- HDU-1002-A+B
- hdu 1002 A+B
- HDU 1002 A+B(大数)
- HDU-1002 大数A+B
- hdu 1002 A+B problem ||
- hdu 1002 A+B Problem
- HDU 1002 A+B Problem
- hdu 1002 A+B Problem ||
- HDU 1002 A+B problem
- java
- WCF AJAX在asp.net上的初级实现DEMO
- git 操作实例(git commit, git push, git branch, git checkout, git reset)
- 程序员/开发者的时间都去哪了?
- Lua和C语言的交互(二)
- HDU 1002 A+B problemII
- Lua和C语言的交互(一)
- 【小白笔记】PHP学习之路 (17) --通过回调函数得到数组交集或差集
- HDU-4288 Coder 线段树
- 在PLSQL"Command Windows"中执行导入导出操作(imp、exp命令)
- cocos2d-x笔记(2)
- tar和bzip2的使用
- 【护眼程序 2.0】源代码
- mysql实现一样变多行(表关联,批量实现)