#abc353c. C - Sigma Problem
C - Sigma Problem
Score: points
问题陈述
对于正整数 和 ,定义 为 除以 的余数。
给定一个长度为 的正整数序列 。找出以下表达式的值:
$\displaystyle \sum_{i=1}^{N-1}\sum_{j=i+1}^N f(A_i,A_j)$。
以上为大语言模型 kimi 翻译,仅供参考。
Problem Statement
For positive integers and , define as the remainder of divided by .
You are given a sequence of positive integers of length . Find the value of the following expression:
$\displaystyle \sum_{i=1}^{N-1}\sum_{j=i+1}^N f(A_i,A_j)$.
Constraints
- All input values are integers.
Input
The input is given from Standard Input in the following format:
Output
Print the answer.
Sample Input 1
3
3 50000001 50000002
Sample Output 1
100000012
Thus, the answer is .
Note that you are not asked to compute the remainder of the sum divided by .
Sample Input 2
5
1 3 99999999 99999994 1000000
Sample Output 2
303999988
相关
在下列比赛中: