-
Notifications
You must be signed in to change notification settings - Fork 0
/
Day 2
69 lines (54 loc) · 1.56 KB
/
Day 2
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
Today I have solved some questions on codechef .
1.The Cheaper Cab.
Question:
Problem
Chef has to travel to another place. For this, he can avail any one of two cab services.
The first cab service charges XX rupees.
The second cab service charges YY rupees.
Chef wants to spend the minimum amount of money. Which cab service should Chef take?
Input Format
The first line will contain TT - the number of test cases. Then the test cases follow.
The first and only line of each test case contains two integers XX and YY - the prices of first and second cab services respectively.
Output Format
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).
Constraints
1 \leq T \leq 1001≤T≤100
1 \leq X, Y \leq 1001≤X,Y≤100
Sample 1:
Input
Output
3
30 65
42 42
90 50
FIRST
ANY
SECOND
Explanation:
Test case 11: The first cab service is cheaper than the second cab service.
Test case 22: Both the cab services have the same price.
Test case 33: The second cab service is cheaper than the first cab service.
Ans:
#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<<"SECOND"<<endl;
}
else{
cout<<"ANY"<<endl;
}
}
return 0;
}