[Solution] TV Discount solution codechef

TV Discount solution codechef – Chef is looking to buy a TV and has shortlisted two models. The first one costs A rupees, while the second one costs B rupees.

Table of Contents

[Solution] TV Discount solution codechef

Since there is a huge sale coming up on Chefzon, Chef can get a flat discount of C rupees on the first TV, and a flat discount of D rupees on the second one.

Help Chef determine which of the two TVs would be cheaper to buy during the sale.

Input Format

  • The first line contains a single integer T — the number of test cases. Then the test cases follow.
  • The first and only line of each test case contains four space-separated integers ABC and D — the marked price (in rupees) of the first TV, the marked price (in rupees) of the second TV, the flat discount (in rupees) of the first TV, and the flat discount (in rupees) of the second TV.

Output Format

For each test case, print a single line containing the string First if the first TV is cheaper to buy with discount, or Second if the second TV is cheaper to buy with discount. If both of them cost the same after discount, print Any.

You may print each character of the string in uppercase or lowercase (for example, the strings firstFirstfIRSt, and FIRST will all be treated as identical).

[Solution] TV Discount solution codechef

  • 1 \leq T \leq 5000
  • 1 \leq A, B \leq 100
  • 0 \leq C \leq A
  • 0 \leq D \leq B

Sample 1:

Input

Output

3
85 75 35 20
100 99 0 0
30 40 0 10
First
Second
Any

[Solution] TV Discount solution codechef Explanation:

Test case 1: The cost of the first TV after discount is 85 – 35 = 50, while the cost of the second TV after discount is 75 – 20 = 55. Thus the first TV is cheaper to buy than the second.

Test case 2: The cost of the first TV after discount is 100 – 0 = 100, while the cost of the second TV after discount is 99 – 0 = 99. Thus the second TV is cheaper to buy than the first.

Test case 3: The cost of the first TV after discount is 30 – 0 = 30, while the cost of the second TV after discount is 40 – 10 = 30. Since they are equal, Chef can buy any of them.

For Solution

“Click Here”

Leave a Comment