Skip to content

Commit 7aaa0c1

Browse files
authored
Merge pull request larissalages#194 from Anupam-Panwar/master
Added code of Covid Run Problem
2 parents 7228d0e + 5bb1f50 commit 7aaa0c1

File tree

1 file changed

+59
-0
lines changed

1 file changed

+59
-0
lines changed

CodeChef_problems/CVDRUN.cpp

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
//************************** it's all about practice ***********************
2+
#include<bits/stdc++.h>
3+
using namespace std;
4+
//**** Abbrevations ****
5+
typedef long long ll;
6+
typedef unsigned long long ull;
7+
typedef long double ld;
8+
//**** STL ****
9+
#define pb push_back
10+
#define pf push_front
11+
#define ppb pop_back
12+
#define ppf pop_front
13+
#define ff first
14+
#define ss second
15+
#define mp make_pair
16+
#define ALL(x) x.begin(), x.end()
17+
//**** some I/O ****
18+
#define no cout << "NO\n"
19+
#define yes cout << "YES\n"
20+
//**** Fast I/O ****
21+
#define FAST_IO ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
22+
//**** Short Code ****
23+
#define tc ll t;cin>>t;while(t--)
24+
#define fi(a,b) for(ll i=a;i<b;i++)
25+
#define fj(a,b) for(ll j=a;j<b;j++)
26+
#define fk(a,b) for(ll k=a;k<b;k++)
27+
/*---------------------------------------------------------------------------*/
28+
int main()
29+
{
30+
FAST_IO
31+
tc
32+
{
33+
int n,k,x,y;
34+
cin>>n>>k>>x>>y;
35+
bool c=false;
36+
int i=x;
37+
if(x==y)
38+
c=true;
39+
else
40+
i=(i+k)%n;
41+
while(i!=x)
42+
{
43+
if(i==y)
44+
{
45+
c=true;
46+
break;
47+
}
48+
else
49+
i=(i+k)%n;
50+
}
51+
if(c==true)
52+
yes;
53+
else
54+
no;
55+
56+
}
57+
return 0;
58+
}
59+

0 commit comments

Comments
 (0)