Advertisement
Guest User

CDVR3.3

a guest
Nov 6th, 2022
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include<iostream>
  2. using namespace std;
  3. int main()
  4. {
  5.     int t; cin>>t;
  6.     while(t--)
  7.     {
  8.         unsigned int x=0,y=0,t=0;
  9.         if (scanf("%u %u",&x,&y));
  10.         if (x > y)
  11.         {
  12.             t = x;
  13.             x = y;
  14.             y = t;
  15.         }
  16.         if (x*2 < y)
  17.         {
  18.             cout<<"NO\n";
  19.             continue;
  20.         }
  21.         x%=3; y%=3;
  22.         if (x > y) {t = x; x = y; y = t;}
  23.         if (x == 0 && y == 0) cout<<"YES\n";
  24.         else if (x == 1 && y == 2) cout<<"YES\n";
  25.         else if (x == 2 && y == 1) cout<<"YES\n";
  26.         else printf("NO\n");
  27.     }
  28.     return 0;
  29. }
Tags: CDVR3.1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement