| ||||||||||
| 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 | |||||||||
请各位大牛帮我看看1503题的代码,测试好象没什么问题但总是WRONG ANSWER!!!谢谢^_^#include<iostream.h>
#include<string.h>
char VeryLongInteger[101];
char temp[101];
int sum[103];
void main()
{
int i,j,k,m;
cin>>temp;
while(strcmp(temp,"0"))
{
for(i=0;temp[i]!='\0';i++);
for(j=i-1;j>=0;j--)
VeryLongInteger[i-1-j]=temp[j];
for(k=0;k<i;k++)
sum[k]+=VeryLongInteger[k]-'0';
for(k=0;k<103;k++)
{
if(sum[k]>9)
{
sum[k]-=10;
sum[k+1]++;
}
}
for(k=102;k>=0;k--)
{
if(sum[k]!=0)
break;
}
cin>>temp;
}
for(m=k;m>=0;m--)
cout<<sum[m];
cout<<endl;
}
Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator