Mitu is packing a fragile gift box (the "knapsack") for a farewell event and, since items can be split into fractions (like ribbon lengths or fabric), wants to maximize total sentimental value within a weight limit. Given N items each with a weight and value, and a knapsack capacity W, you may take fractions of items. Maximize total value. Print the answer rounded to 2 decimal places.
Input
Line1: N W. Next N lines: weight value.
Output
Maximum value, 2 decimals.
Constraints
1 ≤ N ≤ 10^5, 1 ≤ W ≤ 10^6
Sample Input
3 50 10 60 20 100 30 120
Sample Output
240.00
main.c
Loading editor…
Write C, then Run (custom I/O) or Submit (sample tests). ⌘/Ctrl+Enter submits.