QOJ.ac

QOJ

Límite de tiempo: 2 s Límite de memoria: 512 MB Puntuación total: 100

#5266. 绝对平坦

Estadísticas

Alice 拥有一张四条腿的桌子,她希望这张桌子是平的。如果桌子的四条腿长度相等,Alice 就认为这张桌子是平的。

Alice 测量了桌子当前四条腿的长度,分别为 $a_1, a_2, a_3$ 和 $a_4$。她还有一个长度为 $b$ 的垫片。Alice 可以选择将垫片安装在其中一条腿上,此时该腿的长度会增加 $b$。她也可以选择不使用垫片,此时所有腿的长度保持不变。注意,Alice 只有一个垫片,因此她既不能将其两次应用到同一条腿上,也不能将其应用到两条不同的腿上。

请判断 Alice 是否能使她的桌子变平。

输入格式

输入包含五个正整数 $a_1, a_2, a_3, a_4$ 和 $b$,每个整数占一行,分别表示桌子四条腿的长度以及 Alice 拥有的垫片的长度 ($1 \le a_i, b \le 100$)。

输出格式

如果 Alice 能使桌子变平,输出 1,否则输出 0。

样例

样例输入 1

10
10
10
10
5

样例输出 1

1

样例输入 2

13
13
5
13
8

样例输出 2

1

样例输入 3

50
42
42
50
8

样例输出 3

0

样例输入 4

20
40
10
30
2

样例输出 4

0

说明

在第一个样例测试中,桌子已经是平的,不需要垫片。

在第二个样例测试中,Alice 可以将垫片安装在第三条腿上,使桌子变平。

在第三个和第四个样例测试中,Alice 无法使她的桌子变平。

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.