z-climber
Mister Little Z. started practicing free climbing. The wall he is practicing on is N + 1 squares tall and 2*K+1 squares wide. The bottom left square is at (-K, 0) and the top right is at (K, N)
Mister Little Z. starts from the block (0,0). At each step Little Z climbs one block and either moves left one block, right one block or stays in the same line of climbing. So from (a, b), Little Z. can go to (a-1, b+1), (a, b+1) and (a+1, b+1), as long as the destination square exists.
The question is: In how many ways can Mister Little Z climb to the top level.
InputThe first line of the standard input will contain two numbers N and K. 1 <= N <= 200; 0 <= K <= N.
OutputTo one line of the standard output write one integer representing the number of ways Mister Little Z. can climb to the top level (N-th level)
Input:
Output:
Explanation: Mister Little Z. starts from (0,0), and can climb to the first level to (-1,1), (0,1), (1,1). From each of the three positions he can then climb to the 2nd level in three different ways. Hence the total number of ways is 3*3=9.
2 2Output:
9Explanation: Mister Little Z. starts from (0,0), and can climb to the first level to (-1,1), (0,1), (1,1). From each of the three positions he can then climb to the 2nd level in three different ways. Hence the total number of ways is 3*3=9.
Input:
Output:
3 2Output:
25Submit solution
Coming laterThe grading service will be connected in a later migration step. You can inspect the task and your previous results now.