시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
---|---|---|---|---|---|
1 초 | 512 MB | 180 | 127 | 105 | 70.470% |
On a whiteboard, you have found a list of integers. Is it possible to use all of them to write down a correct arithmetic expression where one of them is the sum of all the others?
You may not alter the integers in any way (e.g., changing the sign or concatenating).
The first line of input contains an integer $n$ ($1 \le n \le 10^4$), representing the number of integers on the whiteboard.
The integers on the whiteboard are given over the next $n$ lines, one per line. Their absolute values are guaranteed to be at most $10^5$.
Print a single integer $x$ which is one of the inputs, and is the sum of all the others. If there’s more than one such $x$, output any one. If there are no such values of $x$, output the string ‘BAD
’.
4 1 6 3 2
6
4 -2 0 5 -3
0
5 1 10 4 2 -3
BAD