Editorial for WC '17 Contest 2 J2 - Breeding an Army
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.
Saruman can create no more than Uruk-hai (rounded down to the nearest integer) before running out of men. Similarly, he can create no more than Uruk-hai due to orc restrictions, and no more than Uruk-hai due to mud restrictions. Putting these facts together, the maximum number of Uruk-hai he can create is the minimum of the three floored quotients , , and .
Comments