Explore PANDORA

Revision en1, by MaithiliSude, 2023-02-01 10:37:15

Links:

Contest

Problem

Author:

Difficulty:

Easy

Problem:

Jack Sully is a very excited to explore the new PANDORA planet and finding new creatures on that planet. For this, he can choose any one of two airline option.

• The first airline service charges X rupees.

• The second airline service charges Y rupees.

Jack wants to spend the minimum amount of money. Which Airline service should Jack Sully take?

Input Format:

There are two integers X and Y . where,

X — The prices of first airline services respectively.

Y — The prices of second airline services respectively.

Constraints:

1≤X,Y≤1000

Output Format:

For each test case,

output "FIRST" (without the quotation marks and in upper case) if the first airline service is cheaper,

output "SECOND"(without the quotation marks and in upper case) if the second airline service is cheaper,

output "ANY" (without the quotation marks and in upper case) if both airline services have the same price.

Sample Input 0

6 10

Sample Output 0

FIRST

Explanation:

The airline service Jack Sully should choose depends on the values of X and Y. If X is less than Y, then he should choose the first airline service as it is cheaper. The problem is to compare the costs of two airline services and determine which one is cheaper, or if both are the same price. Given two integers representing the costs of two airline services, the task is to output one of the following:

  1. FIRST if the first airline service is cheaper
  2. SECOND if the second airline service is cheaper
  3. ANY if both airline services have the same price

This problem can be solved using a simple comparison between X and Y and deciding the cheaper option based on the result. In code, this can be achieved using an if-else statement. If X is less than Y, then the first airline service is selected, and if Y is less than X, then the second airline service is selected. If X and Y are equal, either service can be selected.

In summary, Jack Sully should choose the airline service with the lowest charge in order to spend the minimum amount of money. The choice can be made by comparing X and Y and selecting the cheaper option.

Code:

Editorialist's Code (C++)

Time Complexity:

O(1) For each test case.

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en1 English MaithiliSude 2023-02-01 10:37:15 2972 Initial revision (published)