| ||||||||||
| 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 | |||||||||
Run time errori get run time error , I solved this problem in another judge and get accepted , so what is the error , and thanx in advance
this my code
# include <iostream>
# include <algorithm>
using namespace std;
bool SelfNumbers[10005];
int Sumdigits(int num)
{
int sum = 0;
while(num != 0)
{
sum += num % 10;
num /= 10;
}
return sum;
}
void Self()
{
fill(SelfNumbers,SelfNumbers+10005,true);
int temp;
for (int i = 0 ; i <= 10005 ; i++)
{
temp = i + Sumdigits(i);
SelfNumbers[temp] = false;
}
SelfNumbers[10000] = true;
}
int main()
{
Self();
for (int i = 0 ; i <= 10000;i++)
{
if (SelfNumbers[i])
cout<<i<<endl;
}
return 0;
}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator