atcoder#ABC275G. [ABC275G] Infinite Knapsack
[ABC275G] Infinite Knapsack
Score : points
Problem Statement
There are kinds of items, each with infinitely many copies. The -th kind of item has a weight of , a volume of , and a value of .
Level Takahashi can carry items whose total weight is at most and whose total volume is at most . Under this condition, it is allowed to carry any number of items of the same kind, or omit some kinds of items.
Let be the maximum total value of items Level Takahashi can carry. It can be proved that the limit exists. Find this limit.
Constraints
- All values in the input are integers.
Input
The input is given from Standard Input in the following format:
Output
Print the answer. Your output will be considered correct if the absolute or relative error from the judge's answer is at most .
2
100000000 200000000 100000000
200000000 100000000 100000000
0.6666666666666667
When , Takahashi can carry items whose total weight is at most and whose total volume is at most .
He can carry, for instance, one copy of the -st item and one copy of the -nd item. Then, the total value of the items is . This is the maximum achievable value, so .
It can also be proved that equals . Thus, the answer is .
1
500000000 300000000 123456789
0.2469135780000000