Setting

You will of course all be familiar with binomial coefficients. The binomial coefficient

\( \binom{n}{k}, k \leq n \in \mathbb{N}_{\geq 0} \)

gives the number of ways to choose \(k\) quests of great glory from a set of \(n\) available quests of great glory. The value is defined as follows:

\( \binom{n}{k} = \frac{n!}{k! \cdot (n-k)!} \)

Given two numbers \(k \leq n \in \mathbb{N}_{\geq 0}\), calculate \( \binom{n}{k} \).

Input

The input starts with the number of test cases to follow (you can assume this number to be at most 10,000). Each test case consists of two non-negative integer numbers \(n\) and \(k\) with \( n, k \leq 50 \) on a separate line.

Output

For each test case output on a single line the value of \( \binom{n}{k} \).

Sample Input

4
3 1
1 1
4 2
2 2

Sample Output

3
1
6
1

Upload Solution

Please log in to submit your solution.

Statistics

Difficulty (1 vote)
Average test runtime 0.37
Points (changes over time) 10
Tried by 27 users
Solved by 19 users

Global ranking

# Name Runtime Points worth
1 The Dude 0.13 19
2 Dark 0.15 16
3 ,s/java/NaN/gi 0.16 15
4 Brian 0.16 15
5 Chris Danger 0.17 15
6 Marvin 0.17 15
7 JB 0.20 12
8 Daniel 0.21 12
9 Justin 0.22 11
10 Irfan 0.22 11
11 Melf 0.23 11
12 贝尔恩德 0.23 11
13 Merle 0.51 5
14 Ansgar 0.53 5
15 Tim 0.55 4
16 Mac 0.66 4
17 Philip 0.72 3
18 Skøgland 0.84 3
19 IeM 0.95 3