This question already has an answer here:
- Mathematical Combination 26 answers
Given two integers - n and r, your task is to calculate the combinatorial nCr.
nCr = n! / r! (n-r)!
The caveat is that you have to write code to do this calculation in minimum number of characters.
Input The first line will be number of testcases T. Then T lines follow, each containing two positive integers - n and r.
output Print T lines, each line containing the value of nCr.
1 <= T <= 100 1 <= r <= n <= 1000
You can assume that the value nCr will fit into a signed 64 bit integer.