Loading

Educational Codeforces Round 100 (Rated for Div. 2) A.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 11 damage to the selected monster. Every 77-th (i. e. shots with numbers 77, 1414, 2121 etc.) cannon shot is enhanced and deals 11 damage to all monsters, not just one of them. If some monster's current amount of health points is 00, 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 00 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 𝑡t (1≤𝑡≤1041≤t≤104) — the number of test cases.

Each test case consists of a single line that contains three integers 𝑎a, 𝑏b and 𝑐c (1≤𝑎,𝑏,𝑐≤1081≤a,b,c≤108) — 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).

Example

input

Copy

3
3 2 4
1 1 1
10 1 7

output

Copy

YES
NO
NO

水题,能完成一次绝杀当且仅当三个怪血量和恰好是6 + 3 = 9的倍数(六次单独攻击以及一次齐射),以及每个怪的血量都能够大于等于齐射的次数。

#include <iostream>
using namespace std;
int main()
{
	freopen("data.txt", "r", stdin);
	int t;
	cin >> t;
	while(t--)
	{
		long long a, b, c, sum;
		cin >> a >> b >> c;
		sum = a + b + c;
		if((a + b + c) % 9 != 0 || a < 1 || b < 1 || c < 1) 
		{
			cout << "NO" << endl;
			continue;
		}
		long long round = (a + b + c) / 9;
		if(a >= round && b >= round && c >= round) cout << "YES" << endl;
		else cout << "NO" << endl;
	}
	return 0;
}
posted @ 2020-12-18 08:39  脂环  阅读(239)  评论(0编辑  收藏  举报