PROBLEM LINK:
Practice
Contest: Division 1
Contest: Division 2
Contest: Division 3
Contest: Division 4
Author: iceknight1093
Tester: sushil2006
Editorialist: iceknight1093
DIFFICULTY:
Cakewalk
PREREQUISITES:
None
PROBLEM:
A plastic frame for a pair of spectacles costs X rupees, while a metal frame costs Y rupees.
Chef will buy the metal frame if its cost is at most twice that of the plastic frame.
Decide which frame Chef will buy.
EXPLANATION:
if Y \leq 2X, Chef will buy the metal frame; otherwise he’ll buy the plastic frame.
This can be checked using an if condition.
TIME COMPLEXITY:
\mathcal{O}(1) per testcase.
CODE:
Editorialist's code (PyPy3)
x, y = map(int, input().split())
print('Plastic' if 2*x < y else 'Metal')