Canadian Computing Competition: 2012 Stage 1, Senior #5
You are a mouse that lives in a cage in a large laboratory. The laboratory is composed of one rectangular grid of square cages, with a total of
To get your exercise, the laboratory owners allow you to move between cages. You can move between cages either by moving right between two adjacent cages in the same row, or by moving down between two adjacent cages in the same column. You cannot move diagonally, left or up.
Your cage is in one corner of the laboratory, which has the label
Your brother, who loves numbers, would like to know how many different paths there are between your cage and his that do not pass through any cat cage. Write a program to compute this number of cat-free paths.
Input Specification
The first line of input contains two integers
Output Specification
Output the non-negative integer value representing the number of paths between your cage at position
Sample Input 1
2 3
1
2 1
Output for Sample Input 1
2
Sample Input 2
3 4
3
2 3
2 1
1 4
Output for Sample Input 2
1
Comments
is this really an S5?
yes
To realize the beauty of this task forget about cats. Try to find a pattern then add the cats into consideration.