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.

With S limited to the interval [1, 100], there are only three possible next milestone counts:

  • If 1 \le S \le 9, then the next milestone is 10.
  • If 10 \le S \le 99, then the next milestone is 100.
  • If S = 100, then the next milestone is 1000.

We can use a few if-statements to determine which of the three above cases we're in, and then subtract S from the resulting milestone count to obtain the answer.


Comments

There are no comments at the moment.