No.1414 University of Tokyo Humanities Mathematics 2021 Problem 2 (Modified)
Problem Statement
Let $N, M, K$ be given integers. Choose $M$ distinct integers from the integers between $1$ and $N$, inclusive.
Let $S$ be the set of chosen numbers, and consider the following condition on $S$.
Condition: $S$ contains at least $1$ set consisting of $K$ consecutive integers.
Here, for an integer $k$ at least $2$, a set consisting of $k$ consecutive integers refers to a set that can be written as $\{l, l + 1, \cdots\cdots, l + k - 1\}$ using some integer $l$.
For example, $\{1, 2, 3, 5, 7, 8, 9, 10\}$ contains the sets $\{1, 2, 3\}, \{7, 8, 9\}, \{8, 9, 10\}$, each consisting of $3$ consecutive integers.
How many ways of choosing satisfy the condition? Output this number of ways modulo $998244353$ to the answer file.
Input
$N\ M\ K$
- $2 \leqq K \leqq M \leqq N \leqq 10^7$
- $N, M, K$ are integers.
Output
Output the answer, followed by a newline.
Sample
Sample 1
Input
4 2 2
Output
3
The ways of choosing that satisfy the condition are the $3$ ways $\{1, 2\}, \{2, 3\}, \{3, 4\}$.
Sample 2
Input
10 5 3
Output
126
Sample 3
Input
10000000 5000000 2021
Output
107056641
提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。
evima
37zigen