OLYMPICS24 - Editorial

PROBLEM LINK:

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

Author: notsoloud
Tester: mexomerf
Editorialist: iceknight1093

DIFFICULTY:

TBD

PREREQUISITES:

None

PROBLEM:

Chefland has G gold medals, S silver medals, and B bronze medals at the Olympics.
Chef will be happy only if the team wins at least 5 of each medal.
How many more medals do they need to win?

EXPLANATION:

The team currently has G gold medals, and needs to reach 5.
That requires them to win another (5-G) gold medals.

Similarly, they must win (5-S) silver and (5-B) bronze medals.
The total number of medals required is the sum of these three values, namely

(5-G) + (5-S) + (5-B)

TIME COMPLEXITY:

\mathcal{O}(1) per testcase.

CODE:

Editorialist's code (Python)
g, s, b = map(int, input().split())
print(15 - g - s - b)