PROBLEM LINK:
Practice
Contest: Division 1
Contest: Division 2
Contest: Division 3
Contest: Division 4
Author: tejas10p
Testers: tabr, iceknight1093
Editorialist: iceknight1093
DIFFICULTY:
TBD
PREREQUISITES:
None
PROBLEM:
One store sells an item for 100 rupees with an A percent discount, while another one sells it for 200 rupees with a B percent discount.
Which one is cheaper?
EXPLANATION:
The first store has a discount of A percent of 100, which is A rupees.
So, its cost is 100 - A rupees.
The second store has a discount of B percent of 200, which is 2B rupees.
So, its cost is 200 - 2B rupees.
Now, compare 100 - A against 200 - 2B to determine which one is lower, or if they’re equal.
TIME COMPLEXITY
\mathcal{O}(1) per test case.
CODE:
Editorialist's code (Python)
for _ in range(int(input())):
a, b = map(int, input().split())
if 100 - a < 200 - 2*b: print('First')
elif 100 - a > 200 - 2*b: print('Second')
else: print('Both')