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:
Chef’s excitement starts at Y on the first day of the month, and increases by 1 every day.
What will it be on the X-th day of the month?
EXPLANATION:
The excitement starts at 1 and increases by 1 for each day that passes.
From the 1-st of the month to the X-th, exactly (X-1) days will pass.
So, Chef’s excitement will also increase by exactly (X-1) from its starting value.
The answer is thus
Y + (X-1)
TIME COMPLEXITY:
\mathcal{O}(1) per testcase.
CODE:
Editorialist's code (PyPy3)
x, y = map(int, input().split())
print(x+y-1)