Please enter your email address or userHandle.
Given 3 integer N,R and M. You task is to calculate NCR%M.
The first line of the input contains an integer T denoting the number of test cases.Then T test cases follow. Each test case consists of 3 integers N,R and M.
For each test case output a single integer representing the value of NCR%M
1<=M<=10^5 where M is a square free and the largest prime factor of M is <=50.
4 2 28681
3 1 43710
5 3 3655
We strongly recommend solving this problem on your own before viewing its editorial. Do you still want to view the editorial?
Login to access your submissions.
Please choose 'ReadOnlyMode' if you needn't to 'Edit' the problem e.g. viewing OJ's solution, TestCase Files (TCFs), TimeLimit etc.