Editorial for WC '17 Contest 4 J2 - Anger Management
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.
Submitting an official solution before solving the problem yourself is a bannable offence.
We can iterate over the sequence of events while maintaining two pieces of information – Bruce Banner's current anger level , and the number of times that he's transformed into the Hulk so far (both of which are initially ). Upon inputting each , we should check if both and – if so, it's time to increment by . Either way, we should then increment by . At the end, we can output the final value of .
Comments