Can you post a link to the original problem? I'd like to see the answer if it's eventually posted.
Can you post a link to the original problem? I'd like to see the answer if it's eventually posted.
A little inaccuracy saves tons of explanation. - H.H. Munro
It is a problem regarding school homework but it is not written in english. I only know that the reference solution consists of 6 functions and 92 lines of code and the correct answer for these inputs are:
(1, 2, 3, 4, 5) - price 33
(3, 6, 4, 7) - price 40
(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1) - price 44
(2, 9, 8, 124, 31, 71, 45, 21, 3, 1, 9) - price 849
(178) - price 0
If and when you can, please post the reference solution.
A little inaccuracy saves tons of explanation. - H.H. Munro