CF1877A Goals of Victory

题目描述

有 $n$ 个足球队踢比赛,每两队之间比一次。在每场比赛中,两队各有一个整数表示进球得分,而一个队伍的效率分是每场比赛中这个队伍的进球得分减去对方球队的进球的分的总和。现在给出前 $n-1$ 个球队的效率分,要求求出最后一个球队的效率分是多少。可以保证这个值是一个定值。

输入格式

每个测试点包含多组数据。第一行输入一个整数 $t$ ( $1\le t\le 500$ ) 表示输入的数据组数。接下来的几行表示一组数据。 第一行输入一个整数 $n$ ( $1\le n\le 100$ ) 表示队伍数量。 第二行输入 $n-1$ 个整数 $a_1,a_2,a_3,\dots,a_{n-1}$ 表示前 $n-1$ 个队伍的效率分。

输出格式

对于每组测试数据,输出一行一个整数表示最后一个队伍的效率分。 Translated by [zhzkiller](https://www.luogu.com.cn/user/764944)

说明/提示

In the first test case, below is a possible tournament result: - Team $ 1 $ vs. Team $ 2 $ : $ 1-2 $ - Team $ 1 $ vs. Team $ 3 $ : $ 3-0 $ - Team $ 1 $ vs. Team $ 4 $ : $ 3-2 $ - Team $ 2 $ vs. Team $ 3 $ : $ 1-4 $ - Team $ 2 $ vs. Team $ 4 $ : $ 1-3 $ - Team $ 3 $ vs. Team $ 4 $ : $ 5-0 $ The efficiency of each team is: 1. Team $ 1 $ : $ (1+3+3)-(2+0+2)=7-4=3 $ 2. Team $ 2 $ : $ (2+1+1)-(1+4+3)=4-8=-4 $ 3. Team $ 3 $ : $ (0+4+5)-(3+1+0)=9-4=5 $ 4. Team $ 4 $ : $ (2+3+0)-(3+1+5)=5-9=-4 $ Therefore, the efficiency of the missing team (team $ 4 $ ) is $ -4 $ . It can be shown that any possible tournament of $ 4 $ teams that has the efficiency of $ 3 $ teams be $ 3 $ , $ -4 $ , and $ 5 $ will always have the efficiency of the $ 4 $ -th team be $ -4 $ .