Physical Address
304 North Cardinal St.
Dorchester Center, MA 02124
Chef has to travel to another place. For this, he can avail any one of two cab services.
Chef wants to spend the minimum amount of money. Which cab service should Chef take?
For each test case, output FIRST
if the first cab service is cheaper, output SECOND
if the second cab service is cheaper, output ANY
if both cab services have the same price.
You may print each character of FIRST
, SECOND
and ANY
in uppercase or lowercase (for example, any
, aNy
, Any
will be considered identical).
Input: 3
30 65
42 42
90 50
Output: FIRST
ANY
SECOND
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.
#include <iostream>
using namespace std;
int main() {
int t;
cin>>t;
while(t--)
{
int x,y;
cin>>x>>y;
if(x<y)
{
cout<<"FIRST"<<endl;
}
else if(x==y)
{
cout<<"ANY"<<endl;
}
else
{
cout<<"SECOND"<<endl;
}
}
return 0;
}
n=int(input())
l1=[]
for i in range(n):
n=input().split(" ")
l1.append(n)
for i in range(len(l1)):
if(int(l1[i][0])==int(l1[i][1])):
print("ANY")
elif(int(l1[i][0])>=int(l1[i][1])):
print("SECOND")
else:
print("FIRST")
In our experience, we suggest you solve this The Cheaper Cab CodeChef Solution and gain some new skills from Professionals completely free and we assure you will be worth it.
If you are stuck anywhere between any coding problem, just visit Queslers to get the The Cheaper Cab CodeChef Solution
I hope this The Cheaper Cab CodeChef Solution would be useful for you to learn something new from this problem. If it helped you then don’t forget to bookmark our site for more Coding Solutions.
This Problem is intended for audiences of all experiences who are interested in learning about Data Science in a business context; there are no prerequisites.
Keep Learning!
More Coding Solutions >>