Series Sum

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

요약
n=k부터 무한대로 가는 C(n,k)^p / 2^n의 합을 998244353으로 나눈 나머지를 구한다. p*k <= 10^6이다.
난이도

어려움10점 중 9점

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

문제

Given are two integers kk and pp. Calculate

∑_n=k∞(nk)p2n,\sum\limits\_{n = k}^{\infty} \frac{{n \choose k } ^ p}{2^n}\text{,}

where (nk){n \choose k} denotes a binomial coefficient that equals to n!k!⋅(n−k)!\displaystyle \frac{n!}{k! \cdot (n - k)!}.

It is guaranteed that the result can be represented in the form of rq\frac{r}{q} where rr and qq are positive coprime integers and q≠0q \neq 0. Find r⋅q−1r \cdot q^{-1} modulo 998,244,353998\\,244\\,353.

입력

The first line contains an integer tt (1≤t≤21121 \le t \le 2112), the number of test cases. The test cases follow.

Each test case is described by a single line containing two integers kk and pp (k,p≥1k, p \ge 1; p⋅k≤106p \cdot k \le 10^6).

The total sum of p⋅kp \cdot k over all test cases does not exceed 10610^6.

출력

For each test case, print a single line containing the integer r⋅q−1 mod 998,244,353r \cdot q^{-1} \bmod 998\\,244\\,353: the result of the calculation.

예제1

  1. 예제 1

    입력
    3
    2 3
    1 10
    9 6
    
    예상 출력
    818
    204495126
    16726290