| ||||||||||
| 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>
#define N 10001
int d[N];
int dispose(int n)
{
int sum =n;
while(n/10>=0&&n)
sum+=n%10,n/=10;
return sum;
}
int main()
{
int b=1,i=b;
// FILE *fp;
// fp=fopen("12.txt","w");
while(1)
{
i=dispose(i);
d[i]=1;
if(i>=N)
{
b++;
if(b>=N)
break;
i=b;
while(d[i])
i++;
}
}
for(i=1;i<=N;i++)
if(!d[i])
printf("%d\n",i);//fprintf(fp,"%d\n",i);
return 1;
}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator