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 |
tipsvoid dfs( int step , int last , int now , bignum rest ) { if( rest.p==0 ){ // for( int i=0 ; i<step ; i++) fprintf( fout ,"%d ",ans[ i ]); sum++;// cout << endl; return ; } if( step>=n )return; int Min=rest.q/rest.p+(rest.q%rest.p!=0),Max=a/now; if( Min < last ) Min = last; for( int i=Min ; i <= Max ; i++){ bignum t( n-step , i ); // 这句应该写在这里,而不是下次递归才判断,否则TLE if( t<rest ) return; // 这个return ,饿…… dfs( step+1 , i , now*i , rest-bignum( 1 , i ) ); } } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator