杭电acm1002

[复制链接]
查看11 | 回复2 | 2010-4-26 21:17:09 | 显示全部楼层 |阅读模式
直接模拟平时在纸上做加法
回复

使用道具 举报

千问 | 2010-4-26 21:17:09 | 显示全部楼层
AC的代码,仅供参考。。。#include#includeusing namespace std;char a[1001],b[1001], int c[1001],d[1001];int sum[1005];int main(){
int i,j,k,n=0,la,lb,T,len;
while(cin>>T)
{
for(i=1;i=0;j--)
{
c[la-j]=(int)(a[j])-48;
}
for(j=lb-1;j>=0;j--)
{
d[lb-j]=(int)(b[j])-48;
}
len=(la>lb?la:lb);
for(j=1;j=10)
{
sum[j]-=10;
sum[j+1]++;
}
}
if(sum[j]>0)
{
len++;
}
cout<<"Case "<=1;k--)
{
printf("%d",sum[k]);
}
if(i<T)
printf("\n\n");
else
printf("\n");
}
}
return 0;}
回复

使用道具 举报

千问 | 2010-4-26 21:17:09 | 显示全部楼层
第一、为什么要system("pause");呢?第二、这题目是高精度加法哦。
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行