An open API service indexing awesome lists of open source software.

https://github.com/bapjiws/continuous-knapsack


https://github.com/bapjiws/continuous-knapsack

Last synced: 2 months ago
JSON representation

Awesome Lists containing this project

README

        

The first input line contains 1 ≤ n ≤ 103 items and
capacity 0 ≤ W ≤ 2×106.
Each of n successive input lines contains each item's cost (0 ≤ ci ≤ 2×106) and weight (0 ≤ wi ≤ 2×106). n, W, ci, and wi are integers.
Output the maximum value of items' parts that fit into the knapsack (items can be cut into pieces, with their cost and weight diminishing proportionately) with 3 floating point precision.

Sample Input:

3 50

60 20

100 50

120 30

Sample Output:

180.000