Editorial for COCI '14 Contest 7 #1 Teta
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.
The prices of the meals that are not a part of a menu can be just added to the final solution and removed from the tray. After that, we take one piece of each meal that are part of a menu from the tray. If the sum of their prices is larger than the menu price, we will pay the menu price and remove the meals from the tray. Otherwise, we will pay for each meal separately and remove them from the tray.
Comments