Editorial for COCI '16 Contest 2 #1 Go
                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.
In order to calculate , the number of Pokémon of type 
 that Mirko can evolve, we must implement the algorithm given in the following pseudocode:
Ei = 0
while Mi >= Ki :
    Mi = Mi - Ki + 2
    Ei = Ei + 1
Alternatively, we can use the following formula:
Why this formula is suitable is left as an exercise for the reader.
Now that we have calculated all , all that's left is to output the sum of all 
 and the first Pokémon 
 that has the largest 
.
Comments