CF1230A.Dawid and Bags of Candies

入门

通过率:0%

时间限制:1.00s

内存限制:256MB

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

Dawid has four bags of candies. The ii-th of them contains aia_i candies. Also, Dawid has two friends. He wants to give each bag to one of his two friends. Is it possible to distribute the bags in such a way that each friend receives the same amount of candies in total?

Note, that you can't keep bags for yourself or throw them away, each bag should be given to one of the friends.

达维德有四袋糖果。第 ii 袋包含 aia_i 颗糖果。此外,达维德有两个朋友。他想把每袋糖果都送给这两个朋友中的一个。是否存在一种分配方式,使得每位朋友最终收到的糖果总数相等?

注意:你不能自己留下糖果袋,也不能丢弃它们;每袋糖果都必须送给其中一位朋友。

输入格式

The only line contains four integers a1a_1, a2a_2, a3a_3 and a4a_4 (1≤ai≤1001 \leq a_i \leq 100) — the numbers of candies in each bag.

唯一的一行包含四个整数 a1a_1、a2a_2、a3a_3 和 a4a_4(1≤ai≤1001 \leq a_i \leq 100)——表示每个袋子中的糖果数量。

输出格式

Output YES if it's possible to give the bags to Dawid's friends so that both friends receive the same amount of candies, or NO otherwise. Each character can be printed in any case (either uppercase or lowercase).

如果可以将这些糖果袋分给达维德的朋友们,使得两位朋友获得的糖果数量相同,则输出 YES;否则输出 NO。每个字符可以以任意大小写形式输出(大写或小写均可)。

输入输出样例

  • 输入#1

    1 7 11 5

    输出#1

    YES
  • 输入#2

    7 3 2 5

    输出#2

    NO

说明/提示

In the first sample test, Dawid can give the first and the third bag to the first friend, and the second and the fourth bag to the second friend. This way, each friend will receive 1212 candies.

In the second sample test, it's impossible to distribute the bags.

在第一个样例测试中,Dawid 可以将第一个和第三个袋子分给第一个朋友,将第二个和第四个袋子分给第二个朋友。这样,每个朋友都将收到 1212 颗糖果。

在第二个样例测试中,无法分配这些袋子。

输入解题思路,AI测评打分。不知道怎么写?

首页