시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
---|---|---|---|---|---|
2 초 | 512 MB | 334 | 230 | 204 | 71.831% |
When we have a set of n elements from which we take k elements, we have a combination.
For example, if we have a set with the numbers from 1 to 5, we have the following different combinations:
The following formula will give us the number of k-combinations of n elements:
\[{n \choose k} = \frac{n (n-1)\cdots(n-k+1)}{k(k-1)\cdots 1}\]
As we saw in the list before
Your task is to compute several (n over k) operations.
A line with an integer t. The following t lines will contain 2 integers each separated by spaces. The first value will be n and second k.
For each (n k) pair. Compute the number of k-combinations of a set of size n. Compute the results modulo 1000000007 (10^9 + 7).
6 5 0 5 1 5 2 5 3 5 4 5 5
1 5 10 10 5 1
3 123 54 7 4 20 10
757228090 35 184756
Olympiad > All-Ireland Programming Olympiad > 2016 AIPO Preliminary Round 6번