#P1570. KC 喝咖啡
KC 喝咖啡
Description
KC and SH often went to 85°C in Fuzhou to drink coffee or something else.
One day, KC wanted a cup of coffee. The waiter told him there are kinds of seasonings, and exactly of them can be added to this cup of coffee (KC will add exactly kinds, not fewer). Depending on which seasonings are added, the time needed to make the coffee and the resulting deliciousness will differ.
After learning all seasonings, as a former chemistry contest ace, KC immediately knows the time cost and the deliciousness of each seasoning. Since KC is in a hurry to get back to solving problems, he wants to drink the coffee as soon as possible, but he also wants it to be delicious. So he came up with a plan: he wants to drink the coffee that maximizes , that is, the deliciousness per unit time.
Now KC tells SH the information about the seasonings and asks SH to compute the of the coffee he will drink. But SH does not want to help, so KC turns to you.
Note: denotes summation, so means the total deliciousness divided by the total time cost.
Input Format
The input consists of three lines.
- The first line contains two integers , the number of seasonings and the number to add.
- The next two lines each contain integers. In these two lines, the -th integer of the first line is the deliciousness of seasoning , and the -th integer of the second line is the time cost of seasoning .
Output Format
Output a real number , the maximum value of for KC’s coffee, rounded to three decimal places.
3 2
1 2 3
3 2 1
1.667
Hint
Explanation for Sample 1:
KC chooses seasonings and , $\dfrac{\sum v _ i}{\sum c _ i} = \dfrac{2 + 3}{2 + 1} = 1.667$.
It can be verified that there is no better choice.
Constraints:
For of the testdata: .
For of the testdata: .
For of the testdata: .
For of the testdata: $1 \leq n \leq 200, 1 \leq m \leq n, 1 \leq c[i], v[i] \leq 1 \times 10 ^ 4$.
The testdata guarantees that the answer does not exceed .
Translated by ChatGPT 5
京公网安备 11011102002149号