BAKECAKE1 - Editorial

PROBLEM LINK:

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

Author:
Tester: sushil2006
Editorialist: iceknight1093

DIFFICULTY:

Cakewalk

PREREQUISITES:

None

PROBLEM:

Chef needs 30 coins to bake a cake, and sells it for 50 coins.
He baked N cakes and sold M of them. How much money did he make?

EXPLANATION:

Baking N cakes, at 30 coins each, costs 30\cdot N coins.
Selling M cakes, at 50 coins each, brings in 50\cdot M coins.

So, Chef made a total of

50\cdot M - 30\cdot N

coins.

TIME COMPLEXITY:

\mathcal{O}(1) per testcase.

CODE:

Editorialist's code (PyPy3)
n, m = map(int, input().split())
print(50*m - 30*n)
1 Like