QOJ.ac

QOJ

时间限制: 1 s 内存限制: 1024 MB 总分: 100

#3609. 重构和

统计

你在白板上发现了一组整数。是否可以使用所有这些整数写出一个正确的算术表达式,使得其中一个是其余所有整数的和?

你不能以任何方式修改这些整数(例如,改变符号或进行拼接)。

输入格式

输入的第一行包含一个整数 $n$ ($1 \le n \le 10^4$),表示白板上整数的个数。

接下来的 $n$ 行,每行给出一个白板上的整数。保证它们的绝对值不超过 $10^5$。

输出格式

输出一个整数 $x$,该整数必须是输入中的一个,且等于其余所有整数的和。如果存在多个这样的 $x$,输出其中任意一个即可。如果没有这样的 $x$,则输出字符串 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

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.