PROBLEM LINK:
Practice
Contest: Division 1
Contest: Division 2
Contest: Division 3
Contest: Division 4
Author: pols_agyi_pols
Tester & Editorialist: iceknight1093
DIFFICULTY:
316
PREREQUISITES:
None
PROBLEM:
Messi has A goals and B assists; while Ronaldo has X goals and Y assists.
A goal is worth two points, and an assist is worth one point.
Who has more points?
EXPLANATION:
Messi has 2A + B points in total, while Ronaldo has 2X + Y points.
Compute these two numbers, then use an if
condition to compare them and output the appropriate answer.
TIME COMPLEXITY
\mathcal{O}(1) per testcase.
CODE:
Editorialist's code (Python)
a, b, x, y = map(int, input().split())
messi = 2*a + b
ronaldo = 2*x + y
print('Messi' if messi > ronaldo else ('Ronaldo' if messi < ronaldo else 'Equal'))