Algorithm


 problem Link : https://www.codechef.com/problems/BROKENPHON

Problem

Uttu broke his phone. He can get it repaired by spending  rupees or he can buy a new phone by spending  rupees. Uttu wants to spend as little money as possible. Find out if it is better to get the phone repaired or to buy a new phone.

Input Format

  • The first line contains a single integer  — the number of test cases. Then the test cases follow.
  • The first and only line of each test case contains two space-separated integers  and  — the cost of getting the phone repaired and the cost of buying a new phone.

Output Format

For each test case,

  • output REPAIR if it is better to get the phone repaired.
  • output NEW PHONE if it is better to buy a new phone.
  • output ANY if both the options have the same price.

You may print each character of REPAIRNEW PHONE and ANY in uppercase or lowercase (for example, anyANyAny will be considered identical).

Constraints

  • 1≤�≤1000
  • 1≤�,�≤104

Sample 1:

Input
 
Output
 
3
100 1000
10000 5000
3000 3000
REPAIR
NEW PHONE
ANY

Explanation:

Test Case 1: It is better to get the phone repaired since 100<1000.

Test Case 2: It is better to buy a new phone since 10000>5000.

Test Case 3: Uttu can choose either of the two options since 3000=3000.

Code Examples

#1 Code Example with C Programming

Code - C Programming

#include<stdio.h>

int main()
{
    int t,x,y;
    scanf("%d",&t);
    while(t--)
    {
        scanf("%d %d",&x,&y);
        if(x<y) printf("REPAIR\n">;
        else if(x>y) printf("NEW PHONE\n");
        else if(x==y) printf("ANY\n");
    }
} 
Copy The Code & Try With Live Editor

Input

x
+
cmd
3 100 1000
10000 5000
3000 3000

Output

x
+
cmd
REPAIR
NEW PHONE
ANY
Advertisements

Demonstration


CodeChef solution BROKENPHONE  - Broken Phone  Codechef solution in C,C++

Previous
CodeChef solution XPIRY - Expiring Bread Codechef solution in C,C++
Next
CodeChef solution FLOW006 - Sum of Digits CodeChef solution in C,C++