Knapsack problem/Continuous: Difference between revisions

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

edits