题目: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;
}
原文地址:https://www.cnblogs.com/c4Lnn/p/12104200.html
时间: 2024-11-10 05:38:34