Editorial for COCI '10 Contest 5 #1 Gljive
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.
Notice that distance between the numbers
, if is greater than , otherwise
We add numbers one by one starting from the first. If the running sum becomes greater than
If the sum of all the numbers is not greater than
Comments