Logo
(追記) (追記ここまで)

21180번 - Reconstruct Sum 스페셜 저지다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 512 MB25318716074.766%

문제

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’.

제한

예제 입력 1

4
1
6
3
2

예제 출력 1

6

예제 입력 2

4
-2
0
5
-3

예제 출력 2

0

예제 입력 3

5
1
10
4
2
-3

예제 출력 3

BAD

힌트

출처

ICPC > Regionals > North America > Pacific Northwest Regional > 2020 ICPC Pacific Northwest Region > Division 1 P번

ICPC > Regionals > North America > Pacific Northwest Regional > 2020 ICPC Pacific Northwest Region > Division 2 AG번

(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /