DISCOUNT7 - Editorial

PROBLEM LINK:

Practice
Contest: Division 1
Contest: Division 2
Contest: Division 3
Contest: Division 4

Author: raysh07
Tester: sushil2006
Editorialist: iceknight1093

DIFFICULTY:

TBD

PREREQUISITES:

None

PROBLEM:

You buy N cakes, each with a cost of 100.
However, if you buy at least 5 cakes, each one costs only 85 instead.
How much did you spend?

EXPLANATION:

If N \lt 5, each cake costs 100 rupees.
So, the total cost is 100\cdot N rupees.

If N \ge 5 instead, each cake costs only 85 rupees.
So, the total cost is 85\cdot N rupees in this case.

TIME COMPLEXITY:

\mathcal{O}(1) per testcase.

CODE:

Editorialist's code (PyPy3)
n = int(input())
if n < 5: print(100 * n)
else: print(85 * n)