Score : $500$ points
For a permutation $P = (p_1, p_2, \dots, p_N)$ of $(1,2, \dots, N)$, let us define the score $S(P)$ of $P$ as follows.
There are $N!$ permutations $P$ of $(1,2, \dots, N)$. Find the sum, modulo $998244353$, of the scores of those permutations, each raised to the $K$-th power.
Input is given from Standard Input in the following format:
$N$ $K$
Print $\displaystyle \left(\sum_{P \in S_N} S(P)^K \right) \bmod {998244353}$.
2 2
5
When $N = 2$, there are two possible permutations $P$: $(1,2),(2,1)$.
The score of the permutation $(1,2)$ is found as follows.
The score of the permutation $(2,1)$ is found as follows.
Therefore, the answer in this case is $1^2 + 2^2 = 5$.
3 3
79
All permutations and their scores are listed below.
Thus, we should print $1^3 + 2^3 + 2^3 + 3^3 + 3^3 + 2^3 = 79$.
50 10000
77436607