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

Posted 尘封陌路

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Educational Codeforces Round 100 (Rated for Div. 2)A. Dungeon相关的知识,希望对你有一定的参考价值。

题目链接:
https://codeforces.com/contest/1463/problem/A
(贪心)
*

思路:

每一个周期发射的攻击是9,所以要使相同的增强的攻击击杀,三个数的总数一定要是9的倍数,同时,3个数都要撑过sum/9,即多少个周期,每个周期最少减一次。

AC代码

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll t;
ll a[4];
map<ll,ll> mp;
int main()

	cin>>t;
	while(t--)
	
	//	mp.clear();
		for(int i=1;i<=3;i++) cin>>a[i];
		ll last=0;
		ll sum=a[1]+a[2]+a[3];
		ll p=sum/9;
		//cout<<p<<endl;
		if(sum%9==0&&(a[1]>=p)&&(a[2]>=p)&&(a[3]>=p))
		
			cout<<"YES"<<endl;
		
		else
		
			cout<<"NO"<<endl;
		
				
	
	return 0;

以上是关于Educational Codeforces Round 100 (Rated for Div. 2)A. Dungeon的主要内容,如果未能解决你的问题,请参考以下文章

Educational Codeforces Round 7 A

Educational Codeforces Round 7

Educational Codeforces Round 90

Educational Codeforces Round 33

Codeforces Educational Codeforces Round 54 题解

Educational Codeforces Round 27