Editorial for COCI '08 Regional #2 Majstor
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.
We use the algorithm given in the problem statement to calculate Sven's score. For each round, compare Sven's symbol with the other symbols and add the appropriate number of points to the score.
The largest number of points Sven could have scored can be calculated by trying all three symbols in every round and using the one that scores best.
This is easily done if we write a helper function that takes two arguments, the round number and the symbol Sven supposedly shows in that round. If and are the two numbers we want to calculate for a round (the actual score and the largest possible score), we can calculate them as:
Comments