POJ 1316 Self Numbers
POJ 1316 Self Numbers
http://poj.org/problem?id=1316
33, 39, 51, 57, 69, 84, 96, 111, 114, 120, 123, 129, 141, ...
39=33+3+3;
51=39+3+9;
57=51+5+1;
输出1-10000的不具有这种规律的数。
![](https://images.cnblogs.com/OutliningIndicators/ContractedBlock.gif)
1 # include <stdio.h> 2 int a[10011]={0}; 3 void self(int i) 4 { 5 int flag=i; 6 while(i) 7 { 8 flag+=i%10; 9 i=i/10; 10 } 11 if(flag<10000) 12 a[flag]=1; 13 } 14 int main() 15 { 16 int i,j,k,t; 17 for(i=1;i<10000;i++) 18 { 19 self(i); 20 if(a[i] == 0) 21 printf("%d\n",i); 22 } 23 return 0; 24 }