luogu#P10056. Water
Water
Problem Description
There are cups. Each cup has capacity , and initially contains water of volume . You may perform any number of operations. In each operation, choose any two cups and pour all the water from one cup into the other cup, but during the process the water in the cup must not overflow (i.e., must not exceed its capacity). If this condition is not satisfied, then the operation cannot be performed.
Using legal operations, maximize the volume of water in the cup that contains the most water.
Input Format
One line with three integers .
Output Format
One line with one integer , representing the volume of water in the cup that contains the most water.
5 2 2
4
11 5 7
10
Hint
Sample 1 Explanation
Suppose there are two cups . You can first pour all the water in into . Then has liters of water and has liters of water, and the operations end. At this time, the amount of water in the fullest cup is .
Constraints
| Test Point ID | Special Property | |
|---|---|---|
| It is guaranteed that no matter how you operate, overflow will never occur. | ||
| None. | ||
For of the testdata, , , and .
Translated by ChatGPT 5