欢迎来到起遇信息学
起遇信息学正处于上线筹建阶段,以下功能已全部开放免费体验: ✅ 完整题库浏览与代码提交评测(C / C++ / Python / Java 等) ✅ 入门到进阶的系列课程试读、作业与考试 ✅ AI 提示、AI 作业分析等智能助教功能 ✅ 赛事模拟与个人能力报告 ✅ 邮箱注册开放 ⏳ 付费课程订阅与微信/支付宝支付通道 ⏳ 手机号登录,微信扫码登录、微信公众号绑定 使用中如遇任何问题,欢迎通过页面底部 **"联系我们"** 与我们沟通。
CF1463A.Dungeon
Dungeon
You are playing a new computer game in which you have to fight monsters. In a dungeon you are trying to clear, you met three monsters; the first of them has health points, the second has health points, and the third has .
To kill the monsters, you can use a cannon that, when fired, deals damage to the selected monster. Every -th (i. e. shots with numbers , , etc.) cannon shot is enhanced and deals damage to all monsters, not just one of them. If some monster's current amount of health points is , it can't be targeted by a regular shot and does not receive damage from an enhanced shot.
You want to pass the dungeon beautifully, i. e., kill all the monsters with the same enhanced shot (i. e. after some enhanced shot, the health points of each of the monsters should become equal to for the first time). Each shot must hit a monster, i. e. each shot deals damage to at least one monster.
Input
The first line contains a single integer () — the number of test cases.
Each test case consists of a single line that contains three integers , and () — the number of health points each monster has.
Output
For each test case, print YES if you can kill all the monsters with the same enhanced shot. Otherwise, print NO. You may print each letter in any case (for example, YES, Yes, yes, yEs will all be recognized as positive answer).
Note
In the first test case, you can do as follows: -th shot to the first monster, -th shot to the second monster, -th shot to the third monster, -th shot to the first monster, -th shot to the third monster, -th shot to the third monster, and -th enhanced shot will kill all the monsters.
In the second test case, you can't kill monsters with the same enhanced shot, because the total number of health points of monsters is , and you will kill them in the first 3 shots.
Samples
3
3 2 4
1 1 1
10 1 7
YES
NO
NO
在线编程 IDE
建议全屏模式获得最佳体验
| 进入全屏编程 | Alt+E |
| 递交评测 | Ctrl+Enter |
| 注释/取消注释 | Ctrl+/ |
| 缩放字体 | Ctrl+滚轮 |