-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathProblem-6.txt
57 lines (51 loc) · 1 KB
/
Problem-6.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#include<bits/stdc++.h>
#define int long long int
#define fastio ios_base::sync_with_stdio(false);cin.tie(0);
using namespace std;
const int N = 1e6+5;
int res[N];
void prigame()
{
vector<int>vect;
bool prime[N];
memset(prime, true, sizeof(prime));
for (int p = 2; p * p < N; p++)
{
if (prime[p] == true)
{
for (int i = p * p; i < N; i += p)
prime[i] = false;
}
}
for (int p = 2; p < N; p++)
if (prime[p])
vect.push_back(p);
auto it = vect.begin();
int cnt = 0;
for (int i = 0; i < N; i++)
{
if(*it <= i)
{
++cnt;
++it;
}
res[i] = cnt;
}
}
signed main()
{
fastio;
prigame();
int t;
cin>>t;
while(t--)
{
int x,y;
cin>>x>>y;
if(res[x] <= y)
printf("Chef\n");
else
printf("Divyam\n");
}
return 0;
}