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;
}
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· SQL Server 2025 AI相关能力初探
· Linux系列:如何用 C#调用 C方法造成内存泄露
· AI与.NET技术实操系列(二):开始使用ML.NET
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 阿里最新开源QwQ-32B,效果媲美deepseek-r1满血版,部署成本又又又降低了!
· 单线程的Redis速度为什么快?
· SQL Server 2025 AI相关能力初探
· AI编程工具终极对决:字节Trae VS Cursor,谁才是开发者新宠?
· 展开说说关于C#中ORM框架的用法!