目录

CF1463A-Dungeon

CF1463A-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 $ 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.

输入格式:

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.

输出格式:

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:

1
2
3
4
3
3 2 4
1 1 1
10 1 7

样例输出1:

1
2
3
YES
NO
NO

思路:

实现:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
// Problem: CF1463A Dungeon
// Contest: Luogu
// URL: https://www.luogu.com.cn/problem/CF1463A
// Memory Limit: 250 MB
// Time Limit: 2000 ms
// Author: Ybw051114
//
// Powered by CP Editor (https://cpeditor.org)

#include "ybwhead/ios.h"
int main()
{
    int TTT;
    yin >> TTT;
    while (TTT--)
    {
        int a, b, c;
        yin >> a >> b >> c;
        if ((a + b + c) % 9)
            puts("No");
        else if ((a + b + c) / 9 <= min(a, min(b, c)))
            puts("Yes");
        else
            puts("No");
    }
    return 0;
}