click below for solution

Sunday, 23 January 2022

Hungry Ashish Solution| January Cook-off 2022 Division 3 solution

Ashish can eat at most one thing. Find out what will Ashish eat for his dinner.

Input Format

  • The first line will contain T - the number of test cases. Then the test cases follow.
  • The first and only line of each test case contains three integers XY and Z - the money Ashish has, the cost of a PIZZA and the cost of a BURGER.

Output Format

For each test case, output what Ashish will eat. (PIZZABURGER or NOTHING).

You may print each character of the string in uppercase or lowercase. (for example, the strings PizzapIzZa and piZZa will all be treated as identical).

Constraints

  • 1T100
  • 1X,Y,Z100

Sample Input 1 

3
50 40 60
40 55 39
30 42 37

Sample Output 1 

PIZZA
BURGER
NOTHING

Explanation

Test case-1: Ashish has 50 rupees while the cost of PIZZA is 40. Therefore he can buy a PIZZA for his dinner.

Test case-2: Ashish has 40 rupees. The cost of PIZZA is 55 and the cost of BURGER is 39. Therefore Ashish can not buy a PIZZA but can buy a BURGER for his dinner.

Test case-3: Ashish has 30 rupees which are not sufficient to buy either PIZZA or BURGER. Thus he can not buy anything and remains hungry :(.



































Solution

#include <iostream>
using namespace std;
int main()
{
 int t;
 cin>>t;
 while(t--){
     int x,y,z;
     cin>>x>>y>>z;
     if(y<=x){
         cout<<"PIZZA"<<endl;
     }else if(z<=x){
         cout<<"BURGER"<<endl;
     }else{
         cout<<"NOTHING"<<endl;
     }
 }
    return 0;
}





No comments:

Post a Comment