首页 > 其他 > 详细

Educational Codeforces Round 100 (Rated for Div. 2) A.Dungeon

时间:2020-12-18 10:23:04      阅读:60      评论: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 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;
}

Educational Codeforces Round 100 (Rated for Div. 2) A.Dungeon

原文:https://www.cnblogs.com/lipoicyclic/p/14153138.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!