Advertisement
Saleh127

cc c2020

Oct 2nd, 2020
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.50 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. test
  11. {
  12.  
  13. ll a[1005],c[1005]={0},d,e,f,i,j,k,l,x,y;
  14. cin>>d>>k>>x>>y;
  15. for(i=0;i<10000;i++)
  16. {
  17. f=(x+k)%d;
  18. c[f]=1;
  19. x=(x+k)%d;
  20. }
  21. if(c[y]==1) 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