Educational Codeforces Round 77 (Rated for Div. 2) B. Obtain Two Zeroes

题目:https://codeforces.com/contest/1260/problem/B
思路:易得成立的条件为:\((a+b)\mod3==0\) && \(max(a,b)\le min(a,b)*2\)

#include<bits/stdc++.h>

using namespace std;

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    int T;cin>>T;
    while(T--)
    {
        int a,b;
        cin>>a>>b;
        if((a+b)%3==0&&max(a,b)<=min(a,b)*2) cout<<"YES"<<endl;
        else cout<<"NO"<<endl;
    }
    return 0;
}

猜你喜欢

转载自www.cnblogs.com/c4Lnn/p/12104200.html