Knapsack problem/Continuous: Difference between revisions
Content added Content deleted
(Scala contribution added.) |
(→{{header|C++}}: Added output the lack of which had been previously flagged up.) |
||
Line 498: | Line 498: | ||
=={{header|C++}}== |
=={{header|C++}}== |
||
{{output?|C++|reason}} |
|||
<lang cpp>#include<iostream> |
<lang cpp>#include<iostream> |
||
#include<algorithm> |
#include<algorithm> |
||
Line 594: | Line 593: | ||
return 0; |
return 0; |
||
}</lang> |
}</lang> |
||
{{out}} |
|||
<pre> |
|||
Total Value = 349.378 |
|||
Total Weight = 15 |
|||
Items Used: |
|||
We took 3kg of "salami" and the value it brought is 95 |
|||
We took 3.6kg of "ham" and the value it brought is 90 |
|||
We took 2.5kg of "brawn" and the value it brought is 56 |
|||
We took 2.4kg of "greaves" and the value it brought is 45 |
|||
We took 3.5kg of "welt" and the value it brought is 63.3784 |
|||
</pre> |
|||
===Alternate Version=== |
===Alternate Version=== |
||
Line 649: | Line 660: | ||
} |
} |
||
}</lang> |
}</lang> |
||
{{out}} |
|||
<pre> |
|||
Take all salami |
|||
Take all ham |
|||
Take all brawn |
|||
Take all greaves |
|||
Take 3.5kg of welt |
|||
</pre> |
|||
=={{header|Common Lisp}}== |
=={{header|Common Lisp}}== |