Self Numbers

http://poj.org/problem?id=1316

 1 #include<stdio.h>
 2 #include<string.h>
 3 int  f[10001];
 4 int main()
 5 {
 6     int i;
 7     memset(f,0,sizeof(f));
 8     for (i = 1; i < 10001; i ++)
 9     {
10         int n = i;
11         int ans = n;
12         while(n)
13         {
14             ans += n%10;
15             n /= 10;
16         }
17         f[ans] = 1;
18     }
19     for (i = 1; i < 10001; i ++)
20     {
21         if (f[i]==0)
22             printf("%d\n",i);
23     }
24     return 0;
25 }
View Code

 

posted @ 2013-08-02 11:16  N_ll  阅读(168)  评论(0编辑  收藏  举报