Editorial for COCI '09 Contest 5 #1 Sok
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.
At least one of the three juices will always be fully used. If we know which one, using that we can easily determine the amount of cocktail they can make. Let us determine which juice will be fully used. If we knew that they made liters of cocktail, how much of each juice would they have left over? Obviously orange, apple and pineapple. Using some simple math, we easily see that they can make at most cocktail if the apple juice is the one that will be fully used. This leads us straight to the solution. Simply finding the smallest number from , and and inserting it as in the aforementioned formulas.
Comments