Ball

AtCoder
IDfps_24_p
Time2000ms
Memory256MB
Difficulty
You are given integers $N, M, K$. For each $m = 1, 2, \dots, M$, solve the following problem: > There are $N$ balls numbered $1$ through $N$, and $m+1$ boxes numbered $0$ through $m$. > Box $0$ can hold at most $K$ balls. The other boxes have no upper limit. > Find the number of ways to place all $N$ balls into the boxes, modulo $998244353$. > Two placements are considered different if there exists at least one ball that is placed in different boxes between the two placements. ## Constraints * $1 \leq N \leq 10^5$ * $1 \leq M \leq 10^5$ * $1 \leq K \leq N$ * All input values are integers ## Input The input is given from standard input in the following format: $N$ $M$ $K$ [samples]
Samples
Input #1
3 2 1
Output #1
4
20

Consider the case $m=1$. There are $4$ valid placements of the balls:

*   Put balls $1,2,3$ into box $1$.
*   Put ball $1$ into box $0$, and balls $2,3$ into box $1$.
*   Put ball $2$ into box $0$, and balls $1,3$ into box $1$.
*   Put ball $3$ into box $0$, and balls $1,2$ into box $1$.
Input #2
12345 5 6789
Output #2
583034791
982161077
613932842
770852810
194914198
API Response (JSON)
{
  "problem": {
    "name": "Ball",
    "description": {
      "content": "You are given integers $N, M, K$.   For each $m = 1, 2, \\dots, M$, solve the following problem: > There are $N$ balls numbered $1$ through $N$, and $m+1$ boxes numbered $0$ through $m$.   > Box $0$ c",
      "description_type": "Markdown"
    },
    "platform": "AtCoder",
    "limit": {
      "time_limit": 2000,
      "memory_limit": 262144
    },
    "difficulty": "None",
    "is_remote": true,
    "is_sync": true,
    "sync_url": null,
    "sign": "fps_24_p"
  },
  "statements": [
    {
      "statement_type": "Markdown",
      "content": "You are given integers $N, M, K$.  \nFor each $m = 1, 2, \\dots, M$, solve the following problem:\n\n> There are $N$ balls numbered $1$ through $N$, and $m+1$ boxes numbered $0$ through $m$.  \n> Box $0$ c...",
      "is_translate": false,
      "language": "English"
    }
  ]
}
Full JSON Raw Segments