#P15706. [JAG 2023 Summer Camp #2] Sum of Product of Binomial Coefficients
[JAG 2023 Summer Camp #2] Sum of Product of Binomial Coefficients
题目描述
You are given integers and . For a positive integer , is defined as follows.
- The sum of $\binom{N}{a_1} \times \binom{a_1}{a_2} \times \cdots \times \binom{a_{k-1}}{a_k}$ for all integer sequences that satisfy the condition .
Answer the remainder of divided by .
For each input, solve test cases.
Note that represents "the number of ways to select distinct items from items" (i.e., the binomial coefficient).
输入格式
$$\begin{aligned} & T \\ & \text{case}_1 \\ & \vdots \\ & \text{case}_T \end{aligned} $$Each test case is given in the following format.
The input satisfies the following constraints.
- All test cases consist of integers.
- The sum of in one test case does not exceed .
输出格式
Output the remainder of divided by for each test case.
3
3 3
0 1
31415 92653
99
1
276482222