#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 NN and KK. For a positive integer kk, f(k)f(k) 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 (a1,a2,,ak)(a_1, a_2, \ldots, a_k) that satisfy the condition Na1a2ak0N \ge a_1 \ge a_2 \ge \ldots \ge a_k \ge 0.

Answer the remainder of k=1Kf(k)\sum_{k=1}^{K} f(k) divided by 998244353998244353.

For each input, solve TT test cases.

Note that (AB)\binom{A}{B} represents "the number of ways to select BB distinct items from AA 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.

NKN \quad K

The input satisfies the following constraints.

  • All test cases consist of integers.
  • 1T1051 \le T \le 10^5
  • 0N1090 \le N \le 10^9
  • 1K2×1051 \le K \le 2 \times 10^5
  • The sum of KK in one test case does not exceed 2×1052 \times 10^5.

输出格式

Output the remainder of k=1Kf(k)\sum_{k=1}^{K} f(k) divided by 998244353998244353 for each test case.

3
3 3
0 1
31415 92653
99
1
276482222