nCr
Submissions: 31103   Accuracy:

24.18%

  Difficulty: Medium
       

Find nCr for given n and r.

Input:
First line contains number of test cases T. T testcases follow. Each testcase contains 1 line of input containing 2 integers n and r separated by a space.

Output:
For each testcase, in a new line, find the nCr. Modulus your output to 109+7.

Constraints:
1 <= T <= 50
1<= n <= 1000
1<= r <=800

Example:
Input:
1
3 2

Output:
3

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

Author: abhiraj26


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