No.2141 Enumeratest
タグ : / 解いたユーザー数 159
作問者 :
milkcoffee
/ テスター :
👑
nok0
Problem Statement
Consider a sequence $A$ of non-negative integers of length $N$ whose sum is $M$.
Let $A_i$ be the $i$-th element of $A$. For $A$, let $f(A)$ be the answer to the following problem.
There are $N$ boxes and $M$ balls. The boxes are numbered $1, \dots ,N$ and the balls are numbered $1, \dots ,M$, and they are distinguishable from one another.
For each $i$, put $A_i$ balls into the $i$-th box. How many ways are there to put the balls?
Find the maximum value of $f(A)$, modulo $998244353$.
Input
$N$ $M$
Output
Output the maximum value of $f(A)$, modulo $998244353$.
Sample
Sample 1
Input
2 3
Output
3
When $A=(0,3)$, $f(A)=1$.
When $A=(1,2)$, $f(A)=3$.
When $A=(2,1)$, $f(A)=3$.
When $A=(3,0)$, $f(A)=1$.
Therefore, the maximum value of $f(A)$ is $3$.
Sample 2
Input
1 1
Output
1
Sample 3
Input
29847 234098
Output
708115871
提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。