大整数加法
来源:互联网 发布:关于程序员的小说 编辑:程序博客网 时间:2024/06/04 23:20
这道题以hdu1002为题意
#include <stdio.h>
#include <string.h>
#define N 1010
int main()
{
int n,lena,l,i,j,flag;
char a[3][N];
int a1[N]={0};
int a2[N];
scanf("%d",&n);
for(int s=1;s<=n;s++)
{
flag=0;
int b=2;
while(b--)
{
scanf("%s",a[b]);
memset(a2,0,sizeof(a2));
lena=strlen(a[b]);
for(i=lena-1,l=0;i>=0;i--)
a2[l++]=a[b][i]-'0';
for(i=0;i<N;i++)
{
a1[i]+=a2[i];
if(a1[i]>=10)
{
a1[i]-=10;
a1[i+1]++;
}
}
}
printf("Case %d:\n",s);
printf("%s + %s = ",a[1],a[0]);
for(i=N-1;i>=0;i--)
if(a1[i])
break;
for(j=i;j>=0;j--)
printf("%d",a1[j]);
printf("\n");
if(s!=n)
printf("\n");
memset(a1,0,sizeof(a1));
}
return0;
}
- 大整数加法
- 大整数加法
- 高精度 大整数加法
- 大整数加法
- 大整数加法
- 大整数加法
- 大整数加法
- 大整数加法计算
- zoj1292大整数加法
- 大整数加法
- 大整数加法
- 大整数加法函数
- 大整数加法
- 大整数加法
- 大整数加法
- 大整数加法
- 大整数加法
- 【算法】大整数加法
- 幼儿园分糖果
- 区块链学习知识模块
- 环链表
- Codeforces Round #424 Div.2 A B C D E F
- 虚拟币开发专题(区块链中使用的技术专业名词解释)
- 大整数加法
- Codeforces 158B
- Java中的常用方法
- 反选
- 数组初始化
- 赛码网刷题之简单计算
- 【数据结构】单链表的插入与删除
- Filter的生命周期
- xcode多余的sourchControl路径