#K80692. Count Teams
Count Teams
Count Teams
You are given the total number of employees n and a team size k. Your task is to calculate the number of unique teams that can be formed by selecting k employees out of n employees. The answer should be computed modulo \(10^9+7\).
The mathematical expression for the number of unique teams is the binomial coefficient:
[ C(n,k)=\binom{n}{k}=\frac{n!}{k!(n-k)!} \quad \text{if} ; k \le n, \quad \text{and} ; 0 ; \text{if} ; k > n. ]
Please note that if \(k > n\), the result is defined as 0. Use modular arithmetic for the computations to avoid overflow issues.
inputFormat
The input is given via stdin and consists of multiple test cases.
The first line contains an integer T representing the number of test cases. Each of the following T lines contains two space-separated integers n and k, where:
- n is the total number of employees.
- k is the required team size.
outputFormat
For each test case, output a single integer on a new line, representing the number of unique teams that can be formed modulo \(10^9+7\).
## sample3
5 3
6 2
10 4
10
15
210
</p>