[Atc349A] Zero Sum Game
该比赛已结束,您无法在比赛模式下递交该题目。您可以点击“在题库中打开”以普通模式查看和递交本题。
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.
Input
The input consists of:
- A single integer — the number of people.
- A list of integers — the final scores of persons to .
Output
Print the final score of person .
Example
Input 1
4
1 2 -1
2
Explanation
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 points.
- Persons and play, and person wins. The players now have points.
- Persons and play, and person wins. The players now have points.
- Persons and play, and person wins. The players now have points.
- Persons and play, and person wins. The players now have points.
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.
3
0 0
0
6
10 20 30 40 50
-150
Programming exercise on 14 August
- 状态
- 已结束
- 规则
- XCPC
- 题目
- 3
- 开始于
- 2024-8-14 16:30
- 结束于
- 2024-8-14 18:30
- 持续时间
- 2 小时
- 主持人
- 参赛人数
- 2