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 |
为什么哪In Reply To:暴力方法,一个一个排除,0MS过了,大牛见笑 Posted by:bhq at 2009-07-31 15:16:30 > //如果某数有generator,它一定可以拆成:i*1001 + j*101 + k*11 + m*2 0<=i,j,k,m<=9 > //数组开到9*1001+9*101+9*11+9*2+1=10036 > > #include <iostream> > using namespace std; > > int main() > { > int selfnum[10036] = {0}; > for ( int i = 0 ; i < 10 ; ++ i ) > for ( int j = 0 ; j < 10 ; ++ j ) > for ( int k = 0 ; k < 10 ; ++ k ) > for ( int m = 0 ; m < 10 ; ++ m ) > selfnum[ i*1001 + j*101 + k*11 + m*2 ] = 1; > for ( int i = 1 ; i <= 10000 ; ++ i ) > if ( selfnum[i] == 0 ) > cout << i << endl; > return 0; > } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator