Posted on 2008-06-04 09:24
superman 阅读(370)
评论(0) 编辑 收藏 引用 所属分类:
ZOJ
1 /* Accepted 1180 C++ 00:01.39 1816K */
2 #include <iostream>
3
4 using namespace std;
5
6 int main()
7 {
8 bool x[1000001] = { false };
9 for(int i = 1; i <= 1000000; i++)
10 {
11 int n = i, sum = i;
12 while(n)
13 {
14 sum += n % 10;
15 n /= 10;
16 }
17 if(sum <= 1000000)
18 x[sum] = true;
19 }
20 for (int i = 1; i <= 1000000; i++)
21 if(x[i] == false)
22 cout << i << endl;
23
24 return 0;
25 }
26