-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathThe Cheaper Cab
39 lines (35 loc) · 1.09 KB
/
The Cheaper Cab
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
The Cheaper Cab
Problem
Chef has to travel to another place. For this, he can avail any one of two cab services.
The first cab service charges X rupees.
The second cab service charges Y rupees.
Chef wants to spend the minimum amount of money. Which cab service should Chef take?
Explanation:
Test case 1: The first cab service is cheaper than the second cab service.
Test case 2: Both the cab services have the same price.
Test case 3: The second cab service is cheaper than the first cab service.
/* 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 x=sc.nextInt();
int y=sc.nextInt();
if(x<y){
System.out.println("FIRST");
}if(x==y){
System.out.println("ANY");
}
if(x>y){
System.out.println("SECOND");
}
}// your code goes here
}
}