Board game

3.2

10 votes
Math Basic, Algorithms, Basic Math, Math
Problem

You are playing a board game. The game consists of cards. The card is a table with the following features:

  • rows numbered from to , considering the bottom to top approach
  • columns numbered from to , considering the left to right approach 

In each move, you can move from a block with coordinates to either of the following coordinates:

You want to know the number of ways you can move from the block to block

Note: Print the answer .

Input format

  • First line: Integer denoting the number of cards
  • Next  lines: card containing one integer denoting the size of the card

Output format

In  lines, print the answer that represents the number of ways you can move from the block to block .

Constraints

Sample Input
3
3
2
5
Sample Output
1
0
2
Time Limit: 1
Memory Limit: 256
Source Limit:
Explanation

There is only one way to go from to and that is .

There is no way to go from to .

There are 2 ways to go from to .

Editor Image

?