Codeforces-1463A

记录自己在CF上的contests
只会A题的痛苦(╯‵□′)╯︵┻━┻

---------------------------------------------------------------
原题地址:1463A.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.
---------------------------------------------------------------
在这里插入图片描述
(ps:试图模拟的后果)
代码如下:

#include 
using namespace std;
int main()
{
     
	int n,a,b,c,t;
	cin >> n;
	int i,sum;
	for(i=1;i<=n;i++)
	{
     
		cin >> a >> b >> c;
		sum=a+b+c;
		if(sum%9!=0)
			cout << "NO" << endl;
		else
		{
     
			t=sum/9;
			if(t>a||t>b||t>c)
				cout << "NO" << endl;
			else
				cout << "YES" <<endl;
		}	
	}
	return 0;
}

你可能感兴趣的:(acm竞赛,c++)