Knapsack problem/Continuous: Difference between revisions
Content added Content deleted
m (→version 1: added/changed whitespace and comments, shorted the SORTD subroutine.) |
m (→{{header|Sidef}}: minor output improvement) |
||
Line 2,547: | Line 2,547: | ||
limit -= item[1]; |
limit -= item[1]; |
||
if (ratio == 1) { |
if (ratio == 1) { |
||
printf("%-8s % |
printf("%-8s %4s %7.2f %6.2f\n", item[0], 'all', item[1], item[2]); |
||
} |
} |
||
else { |
else { |
||
Line 2,559: | Line 2,559: | ||
<pre> |
<pre> |
||
Item Fraction Weight Value |
Item Fraction Weight Value |
||
salami all |
salami all 3.00 95.00 |
||
ham all |
ham all 3.60 90.00 |
||
brawn all |
brawn all 2.50 56.00 |
||
greaves all |
greaves all 2.40 45.00 |
||
welt |
welt 0.95 3.50 63.38 |
||
---------------------------- |
---------------------------- |
||
total value: 349.37837837838 |
total value: 349.37837837838 |