Editorial for WC '18 Contest 3 J1 - An Honest Day's Work


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 P litres of paint and each badge requiring B litres of it, James will produce \lfloor \frac P B \rfloor badges. There will be P - \lfloor \frac P B \rfloor \times B litres of paint left over, which is equivalent to P \bmod B (the remainder when P is divided by B, written as the % operator in most programming languages). Therefore, the number of Pokédollars made will be \lfloor \frac P B \rfloor \times D + (P \bmod B).


Comments

There are no comments at the moment.