A14056 | Dungeon
时间限制1s
内存限制256MB
通过 / 提交0/0
题目描述
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 $a$ health points, the second has $b$ health points, and the third has $c$ .
To kill the monsters, you can use a cannon that, when fired, deals $1$ damage to the selected monster. Every $7$ -th (i. e. shots with numbers $7$ , $14$ , $21$ etc.) cannon shot is enhanced and deals $1$ damage to all monsters, not just one of them. If some monster's current amount of health points is $0$ , 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 $0$ for the first time). Each shot must hit a monster, i. e. each shot deals damage to at least one monster.
To kill the monsters, you can use a cannon that, when fired, deals $1$ damage to the selected monster. Every $7$ -th (i. e. shots with numbers $7$ , $14$ , $21$ etc.) cannon shot is enhanced and deals $1$ damage to all monsters, not just one of them. If some monster's current amount of health points is $0$ , 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 $0$ for the first time). Each shot must hit a monster, i. e. each shot deals damage to at least one monster.
输入格式
The first line contains a single integer $t$ ( $1 \le t \le 10^4$ ) — the number of test cases.
Each test case consists of a single line that contains three integers $a$ , $b$ and $c$ ( $1 \le a, b, c \le 10^8$ ) — the number of health points each monster has.
Each test case consists of a single line that contains three integers $a$ , $b$ and $c$ ( $1 \le a, b, c \le 10^8$ ) — the number of health points each monster has.
输出格式
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).
输入输出样例
输入 #1
3 3 2 4 1 1 1 10 1 7
输出 #1
YES NO NO
In the first test case, you can do as follows: $1$ -th shot to the first monster, $2$ -th shot to the second monster, $3$ -th shot to the third monster, $4$ -th shot to the first monster, $5$ -th shot to the third monster, $6$ -th shot to the third monster, and $7$ -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 $3$ , and you will kill them in the first 3 shots.
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 $3$ , and you will kill them in the first 3 shots.
C++ 编辑器
输入
输出
可保存默认模板;新题优先使用已保存模板。
当前快捷键仅展示,暂不支持修改。
- 撤销
Ctrl / ⌘ + Z - 重做
Ctrl / ⌘ + Y - 查找
Ctrl / ⌘ + F - 全选
Ctrl / ⌘ + A - 复制
Ctrl / ⌘ + C - 剪切
Ctrl / ⌘ + X - 粘贴
Ctrl / ⌘ + V - 自动排版
工具栏排版按钮 - 草稿保存
编辑时自动保存到本机
历史
提交记录
状态说明时间源码
AI
作答助手
你好,我是作答助手。可以问思路、复杂度、样例含义或代码报错原因;不会直接给出完整 AC 代码。
确定要清空代码吗?
提交通过
评测结果:Accepted