| ||||||||||
| 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 | |||||||||
why wa?,能否看看?#include<stdio.h>
#include<string.h>
int main()
{
int i,j,m,n;
char r[104];
for(i=0;i<103;i++)
r[i]='0';
r[103]='\0';
char s[101];
while(1)
{
scanf("%s",s);
if(strcmp(s,"0")==0)
break;
else
for(i=102,j=strlen(s)-1;i>=102-strlen(s)+1;i--,j--)
{
m=r[i]-'0'+s[j]-'0';
n=m%10;
m=m/10;
r[i]=n+'0';
if(m)
r[i-1]+=m;
}
}
for(i=0;i<103;i++)
if(r[i]!='0')
break;
for(j=i;j<103;j++)
printf("%c",r[j]);
printf("\n");
return 0;
}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator