-
Notifications
You must be signed in to change notification settings - Fork 0
/
Better Deal
41 lines (35 loc) · 1.21 KB
/
Better Deal
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
Problem
There are 2 stores in Chefland and both sell the same product. The first store sells the product for
100 rupees whereas the second store sells it for 200 rupees.
It is the holiday season and both stores have announced a special discount.
The first store is providing a discount of A percent on its product and the second store is providing a discount of B percent on its product.
Chef is wondering which store is selling the product at a cheaper price after the discount has been applied.
Can you help him identify the better deal?
/* package codechef; // don't place package name! */
import java.util.*;
import java.lang.*;
import java.io.*;
/* Name of the class has to be "Main" only if the class is public. */
class Codechef
{
public static void main (String[] args) throws java.lang.Exception
{
Scanner sc=new Scanner(System.in);
int t=sc.nextInt();
for(int i=0;i<t;i++){
int a=sc.nextInt();
int b=sc.nextInt();
a=a*100/100;
a=100-a;
b=b*200/100;
b=200-b;
if(a<b){
System.out.println("FIRST");
}else if(a>b){
System.out.println("SECOND");
}else if(a==b){
System.out.println("BOTH");
}
}// your code goes here
}
}