1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
| #include <bits/stdc++.h> #define int long long #define N 1000005 #define mod 1000000007 using namespace std; int n;
void solve(){ int a,b;cin>>a>>b; if(a > b)swap(a,b); if(b - a > a){ cout<<"NO"<<"\n"; return; } a = a % 3;b = b % 3; if(a > b)swap(a,b); if(a == 1 && b == 2)cout<<"YES"<<"\n"; else if(a == 0 && b == 0)cout<<"YES"<<"\n"; else cout<<"NO"<<"\n"; }
signed main(){ int t;cin>>t; while(t--){ solve(); } return 0; }
|