HDU2122
打表找范围!
![](https://images.cnblogs.com/OutliningIndicators/ContractedBlock.gif)
1 #include<stdio.h> 2 int fac[ 12 ]; 3 void init(){ 4 fac[ 0 ]=1; 5 fac[ 1 ]=1; 6 fac[ 2 ]=2; 7 for( int i=3;i<=9;i++ ){ 8 fac[ i ]=fac[ i-1 ]*i; 9 } 10 } 11 void init2(){ 12 init(); 13 printf("1\n2\n"); 14 for( int i=145;i<=50000;i++ ){ 15 int sum=0; 16 int now=i; 17 while( 1 ){ 18 sum+=(fac[ now%10 ]),now/=10; 19 if( now==0 ) 20 break; 21 } 22 if( sum==i ) 23 printf("%d\n",i); 24 } 25 } 26 int main(){ 27 init2(); 28 //printf("end\n"); 29 return 0; 30 }
keep moving...