AtCoder Beginner Contest 471
和的平方之和AI (CI翻译)
Problem Statement
题目描述
AI (CI翻译)There are $N$ balls numbered $1$ to $N$. Ball $i$ has an integer $A_i$ written on it.
有 $N$ 个编号为 $1$ 至 $N$ 的球。球 $i$ 上写有一个整数 $A_i$。AI (CI翻译)
For a way of choosing some balls from the $N$ balls, define the score of that choice as the square of the sum of the numbers written on the chosen balls.
对于从这 $N$ 个球中选择若干个球的一种方式,将所选球上数字之和的平方定义为该选择方式的得分。AI (CI翻译)
Find the sum, modulo $998244353$, of the scores of all $\binom{N}{K}$ ways of choosing $K$ balls from the $N$ balls.
请求出从 $N$ 个球中选择 $K$ 个球的所有 $inom{N}{K}$ 种方式的得分之和,并将结果对 $998244353$ 取模。AI (CI翻译)
Constraints
约束条件
AI (CI翻译)$1 \leq K \leq N \leq 2\times 10^5$$1 \leq A_i \leq 10^9$- All input values are integers.
$1 \leq K \leq N \leq 2\times 10^5$$1 \leq A_i \leq 10^9$- 所有输入值均为整数。
Input
输入格式
AI (CI翻译)The input is given from Standard Input in the following format:
输入从标准输入按以下格式给出:AI (CI翻译)
N K
A_1 \dots A_N
N K
A_1 \dots A_NAI (CI翻译)
Output
输出格式
AI (CI翻译)Output the answer.
输出答案。AI (CI翻译)
样例
Input #1
3 2
1 10 100
Output #1
22422
There are three ways of choosing two balls from three balls: choosing balls $1,2$ gives a score of $(1+10)^2=121$, choosing balls $1,3$ gives a score of $(1+100)^2=10201$, and choosing balls $2,3$ gives a score of $(10+100)^2=12100$.
The answer is the sum of these, $121+10201+12100=22422$.
Input #2
5 2
10 10 20 20 20
Output #2
10600
Multiple balls may have the same number written on them.
Input #3
2 1
998244353 998244353
Output #3
0
Find the sum modulo $998244353$.
题目信息
题面与样例版权归 AtCoder 及出题人所有;中文翻译由 AI 生成(gpt-6.1-sol),如有出入请以原文为准。