| ||||||||||
| 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>
#include<string.h>
#include<ctype.h>
int a[103];
int b[103];
char c[103];
void main()
{
int i=0,j,x;
memset(a,0,sizeof(a));
memset(b,0,sizeof(b));
while((c[i]=getchar())!='0')
{
while((c[++i]=getchar())!='\n')
;
c[i]='\0';
strrev(c);
for(j=0;j<i;j++)
a[j]=c[j]-'0';
for(j=0;j<1039;j++)
{
b[j]+=a[j];
if(b[j]>=10)
{
b[j]-=10;
b[j+1]+=1;
}
}
i=0;
memset(a,0,sizeof(a));
}
x=0;
for(i=102;i>=0;i--)
{
if(x)
printf("%d",b[i]);
else if(b[i])
{
printf("%d",b[i]);
x=true;
}
}
printf("\n");
}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator