#K55122. Pascal's Triangle Element
Pascal's Triangle Element
Pascal's Triangle Element
Given two integers n and k, determine the kth element (0-indexed) in the nth row of Pascal's Triangle. This element is defined as the binomial coefficient \(\binom{n}{k}\), which is given by the formula:
\[ \binom{n}{k} = \frac{n!}{k!(n-k)!} \]
For example, when n = 4
and k = 2
, the answer is 6 since \(\binom{4}{2} = 6\).
inputFormat
The input is read from standard input. The first line contains an integer T specifying the number of test cases. Each of the following T lines contains two integers n and k separated by a space.
outputFormat
For each test case, output a single line containing the corresponding element from Pascal's Triangle (i.e., \(\binom{n}{k}\)).
## sample1
4 2
6
</p>