| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
附代码#include<stdio.h>
char a[1000001],b[1000001],sum[1000001];
main()
{
int n,i,count,k;
scanf("%d",&n);getchar();
for(i=1;i<=n;i++)
{
a[i]=getchar();getchar();
b[i]=getchar();getchar();
}
count=0;
for(i=n;i>=1;i--)
{
k=(a[i]-'0')+(b[i]-'0')+count;
count=k/10;
if(k>=10)
{
k%=10;
}
sum[i]=k+'0';
}
sum[n+1]='\0';
if(count)printf("%d",count);
printf("%s\n",sum+1);
return 0;
}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator