Advertisement
Saleh127

Live ar 6858

Dec 2nd, 2020
136
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.52 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. #define ll long long
  4. #define test int t; cin>>t; for(int cs=1;cs<=t;cs++)
  5. int main()
  6. {
  7. ios_base::sync_with_stdio(0);
  8. cin.tie(0);cout.tie(0);
  9.  
  10. ll n,m,a,b,i,j,k,l;
  11. cin>>n>>m;
  12. test
  13. {
  14. cin>>a;
  15. k=0;
  16. if(a<=2) k=1;
  17. else if(n%a==0 && (m-2)%a==0) k=1;
  18. else if(m%a==0 && (n-2)%a==0) k=1;
  19. else if((n-1)%a==0 && (m-1)%a==0) k=1;
  20.  
  21. if(k) cout<<"YES"<<endl;
  22. else cout<<"NO"<<endl;
  23. }
  24.  
  25.  
  26. return 0;
  27. }
  28.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement