| ||||||||||
| 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 | |||||||||
结果都对着,不明白为什么会runtime error?请高手看一下#include<iostream.h>
int a[10001];
int sum(int n)
{
int res=0;
while(n!=0)
{
res+=n%10;
n=n/10;
}
return res;
}
void main()
{
int i;
for(i=1;i<10001;i++)
a[i+sum(i)]=-1;
for(i=1;i<10001;i++)
if(a[i]!=-1)
cout<<i<<endl;
}
Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator