nCr

Given two integers n and r. In how many ways can r items be chosen from items?
        
       Input:-4
2 1
4 0
5 2
10 3
       Input Description: The first line contains the number of test cases T. Each of the next T lines contains two integers n and r. 
       Output: 2
1 
10 
120
       Output Description: Output T lines, containing the required answer for the corresponding test case. Output all answers modulo 142857. 
       Constraints: 1<= T <=10^5  1<= n<=10^9  0<= r <= n
       Explanation: null

Loading...