atcoder#ARC106D. [ARC106D] Powers
[ARC106D] Powers
Score : points
Problem Statement
Given are integer sequence of length , , and an integer .
For each such that , find the following value:
$\left(\displaystyle \sum_{L=1}^{N-1} \sum_{R=L+1}^{N} (A_L+A_R)^X\right) \bmod 998244353$
Constraints
- All values in input are integers.
Input
Input is given from Standard Input in the following format:
Output
Print lines.
The -th line should contain the value $\left(\displaystyle \sum_{L=1}^{N-1} \sum_{R=L+1}^{N} (A_L+A_R)^X \right) \bmod 998244353$.
3 3
1 2 3
12
50
216
In the -st line, we should print .
In the -nd line, we should print .
In the -rd line, we should print .
10 10
1 1 1 1 1 1 1 1 1 1
90
180
360
720
1440
2880
5760
11520
23040
46080
2 5
1234 5678
6912
47775744
805306038
64822328
838460992
Be sure to print the sum modulo .