A12908 | Dawid and Bags of Candies
时间限制1s
内存限制256MB
通过 / 提交0/0
题目描述
Dawid has four bags of candies. The $i$ -th of them contains $a_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.
Note, that you can't keep bags for yourself or throw them away, each bag should be given to one of the friends.
输入格式
The only line contains four integers $a_1$ , $a_2$ , $a_3$ and $a_4$ ( $1 \leq a_i \leq 100$ ) — the numbers of candies in each bag.
输出格式
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).
输入输出样例
输入 #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 $12$ candies.
In the second sample test, it's impossible to distribute the bags.
In the second sample test, it's impossible to distribute the bags.
C++ 编辑器
输入
输出
可保存默认模板;新题优先使用已保存模板。
当前快捷键仅展示,暂不支持修改。
- 撤销
Ctrl / ⌘ + Z - 重做
Ctrl / ⌘ + Y - 查找
Ctrl / ⌘ + F - 全选
Ctrl / ⌘ + A - 复制
Ctrl / ⌘ + C - 剪切
Ctrl / ⌘ + X - 粘贴
Ctrl / ⌘ + V - 自动排版
工具栏排版按钮 - 草稿保存
编辑时自动保存到本机
历史
提交记录
状态说明时间源码
AI
作答助手
你好,我是作答助手。可以问思路、复杂度、样例含义或代码报错原因;不会直接给出完整 AC 代码。
确定要清空代码吗?
提交通过
评测结果:Accepted