Editorial for Max's Anger Contest Series 1 P1 - Hunger Bar


Remember to use this editorial only when stuck, and not to copy-paste code from it. Please be respectful to the problem author and editorialist.
Submitting an official solution before solving the problem yourself is a bannable offence.

Author: maxcruickshanks

Subtask 1

Maintain a hunger bar set to min(H,A) and keep decrementing it and S until either S is 0 or it is 0 and output the state.

Time Complexity: O(S)

Subtask 2

Output max(0,min(H,A)S).

Time Complexity: O(1)


Comments

There are no comments at the moment.