[Blue Bridge Cup 2015 preliminary round] card type number of species

 

 

Using dfs, find a path length of the path 13.

 Also note that k, is used to control go a few times, walked 13 times

#include <the iostream> 
#include <cstdio> the using namespace STD; Long Long ANS; 
 // CNT has calculated the number of sheets to pick
 // K is the recursive control, control is always set to 0 (i.e. not take) a case void DFS ( int CNT, int K) {
     IF (CNT == 13 is ) ANS ++ ;
     IF (CNT> = 13 is || K> = 13 is ) return ; for ( int I = 0 ; I <= . 4 ; I ++ ) 
        DFS (CNT + I, K + . 1 ); 
}

 

 

    
    

int main () { 
    ANS = 0 ;
     // initializes to 0 the number of sheets, the number of initial take 0 
    DFS ( 0 , 0 ); 
    COUT << ANS << endl;
     return  0 ; 
}

 

Guess you like

Origin www.cnblogs.com/h694879357/p/12236109.html