PROBLEM LINK:
Practice
Contest: Division 3
Contest: Division 2
Contest: Division 1
Author: Jeevan Jyot Singh
Tester : Takuki Kurokawa
Editorialist: Aman Dwivedi
DIFFICULTY:
Cakewalk
PREREQUISITES:
None
PROBLEM:
Ashish is very hungry and wants to eat something. He has X rupees in his pocket. Since Ashish is very picky, he only likes to eat either PIZZA
or BURGER
. In addition, he prefers eating PIZZA
over eating BURGER
. The cost of a PIZZA
is Y rupees while the cost of a BURGER
is Z rupees.
Ashish can eat at most one thing. Find out what will Ashish eat for his dinner.
EXPLANATION:

If X \ge Y, then he will eat
PIZZA
. 
if X \ge Z and X < Y, then he is gonna eat
BURGER
. 
If X < Z, then he will eat Nothing.
TIME COMPLEXITY:
O(1) per test case
SOLUTIONS:
Author's Solution
#include <bits/stdc++.h>
using namespace std;
#define IOS ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
void solve()
{
int x, y, z; cin >> x >> y >> z;
if(x >= y)
cout << "Pizza\n";
else if(x >= z)
cout << "Burger\n";
else
cout << "Nothing\n";
}
int32_t main()
{
IOS;
int T; cin >> T;
for(int tc = 1; tc <= T; tc++)
{
solve();
}
return 0;
}
Tester's Solution
#include <bits/stdc++.h>
using namespace std;
int main() {
int tt;
cin >> tt;
while (tt) {
int x, y, z;
cin >> x >> y >> z;
if (x >= y) {
cout << "PIZZA" << '\n';
} else if (x >= z) {
cout << "BURGER" << '\n';
} else {
cout << "NOTHING" << '\n';
}
}
return 0;
}
Editorialist Solution
#include<bits/stdc++.h>
using namespace std;
void solve()
{
int x,y,z;
cin>>x>>y>>z;
if(x>=y)
cout<<"PIZZA"<<"\n";
else if(x>=z)
cout<<"BURGER"<<"\n";
else
cout<<"NOTHING"<<"\n";
}
int main()
{
ios_base::sync_with_stdio(0);
cin.tie(0);
int t;
cin>>t;
while(t)
solve();
return 0;
}