题目 Q 1616: [Algorithm Improvement VIP]Passing Game
Time limit: 1Sec Memory Limit: 128MB
Title Description
During physical education class, Barbara’s teacher often takes the students to play games together. This time, the teacher took the students together to do the passing game. The rules of the game are as follows: n students stand in a circle, one of the students holding a ball in his hand, when the teacher blows the whistle to start passing the ball, each student can pass the ball to one of his left and right two students (left and right arbitrarily), when the teacher blows the whistle again, the passing stops, at this time, the one holding the ball did not pass out is the loser, to give a show. The clever Barbara asked an interesting question: how many different passing methods can make the ball start passing from Barbara’s hand and return to Barbara’s hand after passing m times. The two methods of passing the ball are treated as different methods when and only when the sequence of students who receive the ball in the order in which they receive it is different in both methods. For example, if there are 3 students #1, #2, and #3, and assuming Barbara is #1, there are 2 ways to return the ball to Barbara after 3 passes: 1-> 2-> 3-> 1 and 1-> 3-> 2-> 1.
Input
A total of one line with two integers n, m separated by spaces (3< =n< =30, 1< =m< =30).
Data size and conventions 100% of the data satisfy: 3< =n< =30, 1< =m< =30
Output
t has a total of one line with an integer that indicates the number of methods that match the question.
Sample Input
|
|
Sample Output
|
|
C Code
|
|