#abc349a. A - Zero Sum Game
A - Zero Sum Game
Score: points
问题陈述
有 个人,编号为 到 ,他们进行了几场一对一的比赛,没有平局。最初,每个人的得分都是 。在每场比赛中,胜者的得分增加 ,而败者的得分减少 (得分可以变成负数)。如果第 个人的最终得分是 ,请确定第 个人的最终得分。可以证明,无论比赛的顺序如何,第 个人的最终得分都是唯一确定的。
以上为大语言模型 kimi 翻译,仅供参考。
Problem Statement
There are people labeled to , who have played several one-on-one games without draws. Initially, each person started with points. In each game, the winner's score increased by and the loser's score decreased by (scores can become negative). Determine the final score of person if the final score of person is . It can be shown that the final score of person is uniquely determined regardless of the sequence of games.
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
4
1 -2 -1
Sample Output 1
2
Here is one possible sequence of games where the final scores of persons are , respectively.
- Initially, persons have points, respectively.
- Persons and play, and person wins. The players now have point(s).
- Persons and play, and person wins. The players now have point(s).
- Persons and play, and person wins. The players now have point(s).
- Persons and play, and person wins. The players now have point(s).
- Persons and play, and person wins. The players now have point(s).
In this case, the final score of person is . Other possible sequences of games exist, but the score of person will always be regardless of the progression.
Sample Input 2
3
0 0
Sample Output 2
0
Sample Input 3
6
10 20 30 40 50
Sample Output 3
-150