fork download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. typedef long long ll;
  4. const int Mod=998244353;
  5.  
  6. void solve() {
  7. int a,b,c;
  8. cin >> a >> b >> c;
  9. int k=b-a;
  10. c-=k;
  11. if(c>=b && (c-b)%3==0){
  12. cout << "YES\n";
  13. return;
  14. }
  15. cout << "NO\n";
  16. }
  17.  
  18. int main(){
  19. ios::sync_with_stdio(false);
  20. cin.tie(nullptr);
  21.  
  22. int t;
  23. cin >> t;
  24. while (t--) solve();
  25.  
  26.  
  27. return 0;
  28. }
  29.  
Success #stdin #stdout 0.01s 5288KB
stdin
4
3 5 10
12 20 30
3 5 7
1 5 6
stdout
YES
NO
YES
NO