Sum of Product of Binomial Coefficients

시간 제한2초메모리 제한1024 MB

요약
각 테스트 케이스에서 f(1)부터 f(K)까지의 중첩 이항계수 곱의 합을 구해 998244353으로 나눈 나머지를 출력한다.
난이도

어려움10점 중 8점

유형
조합론, 수학, 동적 계획법, 정수론
정답자
아직 제출이 없습니다

문제

You are given integers NN and KK. For a positive integer kk, f(k)f(k) is defined as follows.

  • The Sum of (Na_1)×(a_1a_2)×⋯×(a_k−1a_k)\binom{N}{a\_1} \times \binom{a\_1}{a\_2} \times \cdots \times \binom{a\_{k-1}}{a\_k} for all integer sequences (a_1,a_2,…,a_k)(a\_1, a\_2, \dots, a\_k) that satisfy the condition N≥a_1≥a_2≥⋯≥a_k≥0N \ge a\_1 \ge a\_2 \ge \dots \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).

입력

TT

case_1\text{case}\_1

⋮\vdots

case_T\text{case}\_T

Each test case is given in the following format.

NN KK

출력

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

제한

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

예제1

  1. 예제 1

    입력
    3
    3 3
    0 1
    31415 92653
    
    예상 출력
    99
    1
    276482222