Blue Bridge Cup 2015- provincial tournament -C / C ++ - A set of 6 questions

topic

Several kinds of card type

X Xiao Ming was hijacked to Las Vegas, was forced to play cards with three other people.
A deck of cards (remove ace size, a total of 52), evenly distributed to four people, each person 13.
At this time, Xiao Ming mind suddenly emerge a question:
If you do not consider the color, only consider points not consider the order of the cards they receive, their own hands to get the initial card type combination, a total of how many do?

Please fill in the integer, do not fill in any extra content or captions.

Thinking

dfs

Code

1 #include <iostream>
 2  a using  namespace std;
 3  int SUM = 0 ;
 4  void the DFS ( int value, int num_cnt) {
 5       IF (num_cnt == 13 ) { // 13 cards you can sec I? ! 
. 6           SUM ++;         // Qi, counting back 
. 7           return ;
 . 8       }
 . 9       IF (value == 14 ) { // points over, and back 
10           return ;
 . 11       }
 12 is       for( Int I = 0 ; I <= . 4 ; I ++ ) {
 13 is           DFS (value + . 1 , num_cnt + I); // begin the next point card 
14       }
 15  }
 16  int main () {
 . 17       DFS ( . 1 , 0 );
 18 is       COUT SUM << << endl;
 . 19       return  0 ;
 20 is }

Guess you like

Origin www.cnblogs.com/memocean/p/12215008.html