欢迎来到起遇信息学
起遇信息学正处于上线筹建阶段,以下功能已全部开放免费体验: ✅ 完整题库浏览与代码提交评测(C / C++ / Python / Java 等) ✅ 入门到进阶的系列课程试读、作业与考试 ✅ AI 提示、AI 作业分析等智能助教功能 ✅ 赛事模拟与个人能力报告 ✅ 邮箱注册开放 ⏳ 付费课程订阅与微信/支付宝支付通道 ⏳ 手机号登录,微信扫码登录、微信公众号绑定 使用中如遇任何问题,欢迎通过页面底部 **"联系我们"** 与我们沟通。
CF2104A.Three Decks
Three Decks
Monocarp placed three decks of cards in a row on the table. The first deck consists of cards, the second deck consists of cards, and the third deck consists of cards, with the condition .
Monocarp wants to take some number of cards (at least one, but no more than ) from the third deck and distribute them between the first two decks so that each of the taken cards ends up in either the first or the second deck. It is possible that all the cards taken from the third deck will go into the same deck.
Your task is to determine whether Monocarp can make the number of cards in all three decks equal using the described operation.
Input
The first line contains a single integer () — the number of test cases.
The only line of each test case contains three integers , and () — the number of cards in the first, second, and third decks, respectively.
Additional constraint on the input: .
Output
For each test case, output "YES" (without quotes) if Monocarp can make the number of cards in all three decks equal using the described operation. Otherwise, output "NO" (without quotes).
Note
In the first test case, Monocarp has to take cards from the third deck, put cards in the first deck, and card in the second deck. Thus, there will be cards in all three decks.
In the second test case, it is impossible to make the number of cards in all three decks equal.
In the third test case, Monocarp has to take cards from the third deck and put both in the first deck. Thus, there will be cards in all three decks.
In the fourth test case, it is also impossible to make the number of cards in all three decks equal.
Samples
4
3 5 10
12 20 30
3 5 7
1 5 6
YES
NO
YES
NO
在线编程 IDE
建议全屏模式获得最佳体验
| 进入全屏编程 | Alt+E |
| 递交评测 | Ctrl+Enter |
| 注释/取消注释 | Ctrl+/ |
| 缩放字体 | Ctrl+滚轮 |