https://github.com/bapjiws/continuous-knapsack
https://github.com/bapjiws/continuous-knapsack
Last synced: 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/bapjiws/continuous-knapsack
- Owner: bapjiws
- Created: 2015-11-26T07:39:21.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2015-11-26T08:02:06.000Z (over 9 years ago)
- Last Synced: 2025-01-28T16:44:23.613Z (4 months ago)
- Language: Python
- Size: 4.88 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
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