Codeforces Round 919 (Div. 2)
E
Counting Binary Strings
Codeforces
2100
原题
← DF1 →
翻译中…

Patrick calls a substring$^\dagger$ of a binary string$^\ddagger$ good if this substring contains exactly one 1.

翻译中…

Help Patrick count the number of binary strings $s$ such that $s$ contains exactly $n$ good substrings and has no good substring of length strictly greater than $k$. Note that substrings are differentiated by their location in the string, so if $s =$ 1010 you should count both occurrences of 10.

翻译中…

$^\dagger$ A string $a$ is a substring of a string $b$ if $a$ can be obtained from $b$ by the deletion of several (possibly, zero or all) characters from the beginning and several (possibly, zero or all) characters from the end.

翻译中…

$^\ddagger$ A binary string is a string that only contains the characters 0 and 1.

翻译中…

Input

翻译中…

Each test consists of multiple test cases. The first line contains a single integer $t$ ($1 \leq t \leq 2500$) — the number of test cases. The description of the test cases follows.

翻译中…

The only line of each test case contains two integers $n$ and $k$ ($1 \leq n \leq 2500$, $1 \leq k \leq n$) — the number of required good substrings and the maximum allowed length of a good substring.

翻译中…

It is guaranteed that the sum of $n$ over all test cases does not exceed $2500$.

翻译中…

Output

翻译中…

For each test case, output a single integer — the number of binary strings $s$ such that $s$ contains exactly $n$ good substrings and has no good substring of length strictly greater than $k$. Since this integer can be too large, output it modulo $998\,244\,353$.

翻译中…

Note

翻译中…

In the first test case, the only suitable binary string is 1. String 01 is not suitable because it contains a substring 01 with length $2 \gt 1$.

翻译中…

In the second test case, suitable binary strings are 011, 110 and 111.

翻译中…

In the third test case, suitable binary strings are 101, 0110, 0111, 1110, and 1111.

翻译中…

样例

Input #1
6
1 1
3 2
4 2
5 4
6 2
2450 2391
Output #1
1
3
5
12
9
259280854
InputCopy OutputCopy
题目信息
题号
1920E
时间限制
2 s
内存限制
512 MB
标签
组合数学
动态规划
数学

题面与样例版权归 Codeforces 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。