Editorial for WC '17 Contest 3 J1 - Like, Comment, and Subscribe!
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.
With limited to the interval
, there are only three possible next milestone counts:
- If
, then the next milestone is
.
- If
, then the next milestone is
.
- If
, then the next milestone is
.
We can use a few if-statements to determine which of the three above cases we're in, and then subtract from the resulting milestone count to obtain the answer.
Comments