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.

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 X liters of cocktail, how much of each juice would they have left over? Obviously A - X \times I orange, B - X \times J apple and C - X \times K pineapple. Using some simple math, we easily see that they can make at most A/I 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 A/I, B/J and C/K and inserting it as X in the aforementioned formulas.


Comments

There are no comments at the moment.