atcoder#ABC260H. [ABC260Ex] Colorfulness
[ABC260Ex] Colorfulness
Score : points
Problem Statement
There are balls numbered through . Ball is painted in Color .
For a permutation of , let us define as follows:
- The number of pairs of adjacent balls with different colors when Balls are lined up in a row in this order.
Let be the set of all permutations of . Also, let us define by:
$$\displaystyle F(k) = \left(\sum_{P \in S_N}C(P)^k \right) \bmod 998244353 $$Enumerate .
Constraints
- All values in input are integers.
Input
Input is given from Standard Input in the following format:
Output
Print the answers in the following format:
3 4
1 1 2
8 12 20 36
Here is the list of all possible pairs of .
- If , then .
- If , then .
- If , then .
- If , then .
- If , then .
- If , then .
We may obtain the answers by assigning these values into . For instance, .
2 1
1 1
0
10 5
3 1 4 1 5 9 2 6 5 3
30481920 257886720 199419134 838462446 196874334