Skip to content

Commit

Permalink
Create abc.cpp
Browse files Browse the repository at this point in the history
  • Loading branch information
sans242 authored Oct 22, 2020
1 parent cac9dd4 commit abd9d10
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions abc.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#include <iostream>
using namespace std;

int main() {
// your code goes here
int t;
cin>>t;

while(t--){
int n,k,x,y;
cin>>n>>k>>x>>y;
int flag=0;

for(int i=0;i<n;i++){
int inf=k*i+x;
if(inf>n){
inf=inf%n;
}
if(y==inf){
flag=1;
break;
}
}

if(flag) cout<<"YES\n";
else cout<<"NO\n";
}

0 comments on commit abd9d10

Please sign in to comment.