Knapsack problem/Continuous: Difference between revisions
Content added Content deleted
m (Tested with `ocaml-4.02.3`.) |
|||
Line 2,170: | Line 2,170: | ||
=={{header|OCaml}}== |
=={{header|OCaml}}== |
||
{{output?|OCaml|reason}} |
|||
<lang ocaml>let items = |
<lang ocaml>let items = |
||
[ "beef", 3.8, 36; |
[ "beef", 3.8, 36; |
||
Line 2,205: | Line 2,204: | ||
Printf.printf " Total Price: %.3f\n" (float price +. last_price); |
Printf.printf " Total Price: %.3f\n" (float price +. last_price); |
||
;;</lang> |
;;</lang> |
||
{{out}} |
|||
Items Weight Price |
|||
greaves: 2.40 45 |
|||
brawn: 2.50 56 |
|||
ham: 3.60 90 |
|||
salami: 3.00 95 |
|||
welt: 3.50 63.38 |
|||
Total Price: 349.378 |
|||
=={{header|Oforth}}== |
=={{header|Oforth}}== |