Paths to reach origin
Submissions: 4531   Accuracy:

59.02%

  Difficulty: Easy   Marks: 2

You are standing on a point (n, m) and you want to go to origin (0, 0) by taking steps either left or down i.e. from each point you are allowed to move either in (n-1, m) or (n, m-1). Find the number of paths from point to origin.

Input:
The first line of input contains an integer T denoting the number of test cases. Then T test cases follow. Each test case contains two integers n and m representing the point.

Output:
For each testcase, in a new line, print the total number of paths from point to origin.

Constraints:
1 <= T<= 100
1 <= n, m <= 25

Example:
Input:

3
3 2
3 6
3 0

Output:
10
84
1

** For More Input/Output Examples Use 'Expected Output' option **

Contributor: Ayush Govil
Author: Ayush Govil 1


If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.



Need help with your code? Please use ide.geeksforgeeks.org, generate link and share the link here.

to report an issue on this page.