NYOJ 103 A+B Problem II
来源:互联网 发布:深圳pmp培训机构 知乎 编辑:程序博客网 时间:2024/05/16 08:14
#include<stdio.h>#include<string.h>#define MAX 1005int a1[MAX];int a2[MAX];char s1[MAX];char s2[MAX];int main(){int n,t=1;scanf("%d",&n);while(n--){int i,j,length1,length2;scanf("%s",s1);scanf("%s",s2);memset(a1,0,sizeof(a1));memset(a2,0,sizeof(a2));length1=strlen(s1);for(j=0,i=length1-1;i>=0;i--)a1[j++]=s1[i]-'0';length2=strlen(s2);for(j=0,i=length2-1;i>=0;i--)a2[j++]=s2[i]-'0';for(i=0;i<MAX;i++){a1[i]=a1[i]+a2[i];if(a1[i]>=10){a1[i]-=10;a1[i+1]++;}}printf("Case %d:\n",t++);printf("%s + %s = ",s1,s2);for(i=MAX;(i>=0)&&(a1[i]==0);i--);if(i>=0){for(;i>=0;i--)printf("%d",a1[i]);printf("\n");}elseprintf("0\n");}return 0;}
0 0
- nyoj 103 A + B problem II
- nyoj 103-A+B Problem II
- NYOJ 103 A+B Problem II
- nyoj 103 A+B Problem II
- NYOJ 103 A+B Problem II
- NYOJ 103 A+B Problem II
- NYOJ 103 A+B Problem II
- NYOJ 103 A+B Problem II (大数)
- nyoj 103A+B Problem II
- NYOJ 103 A+B Problem II
- NYOJ-103 A+B Problem II
- nyoj-103 A+B Problem II
- NYOJ 103-A+B Problem II
- NYOJ---A+B Problem II
- NYOJ - A+B Problem II
- NYOJ-A+B Problem II
- NYOJ-A*B Problem II
- NYOJ-A+B Problem II
- 指针(3)智能指针总览
- log4j小结
- 算法导论学习-渐进表达式
- Leetcode || Triangle
- 擅长排列的小明
- NYOJ 103 A+B Problem II
- 《C++程序设计原理与实践》读书笔记
- Oracle学习笔记之oracle 数据库操作之表的管理
- 广告业内人士称跟踪cookie最多还能活五年
- Hama测试问题记录
- ip地址查询api
- 架构与敏捷:不得不说的故事
- Oracle学习笔记之Java操作Oracle数据库
- Java 标准日志工具 Log4j 的使用(附源代码)