-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathCHEFADV.cpp
More file actions
39 lines (34 loc) · 751 Bytes
/
CHEFADV.cpp
File metadata and controls
39 lines (34 loc) · 751 Bytes
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
#include<iostream>
#include<bits/stdc++.h>
using namespace std;
int main()
{
int t,n,m,x,y;
cin>>t;
while(t--)
{
cin>>n>>m>>x>>y;
if(x==1||y==1)
{
if((x==1&&n>=2)&&((m-1)%y==0||(m-1)%y==1))
{ cout<<"Chefirnemo"<<"\n";
continue;
}
if((y==1&&m>=2)&&((n-1)%x==0||(n-1)%x==1))
{ cout<<"Chefirnemo"<<"\n";
continue;
}
}
if((n-1)%x==1||(n-1)%x==0)
{
if((n-1)%x==0&&(m-1)%y==0)
cout<<"Chefirnemo"<<"\n";
else if((n-1)%x==1&&(m-1)%y==1)
cout<<"Chefirnemo"<<"\n";
else
cout<<"Pofik"<<"\n";
continue;
}
cout<<"Pofik"<<"\n";
}
}