Editorial for COCI '16 Contest 5 #1 Tuna


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.

The only problem in this task is data input. In the case when the absolute difference of two numbers from the same line of the input is less than or equal to X, then the total price is increased by the larger of the two numbers. If the difference is strictly larger than X, we know that we have to input another number from the next line, and then add it to the total price. We repeat the described algorithm N times.


Comments

There are no comments at the moment.