Answer the question
In order to leave comments, you need to log in
How to adjust the result having a list of numbers and a total sum?
There is a list of some number of digits.
For example:
[1, 2, 7, 9]
And there is a final amount that should be obtained.
For example, the total sum is 51.
Purpose: use the maximum possible number of digits from the list
and multiply the maximum possible number of digits.
Something like this:
1*2 + 2*4 + 7*2 + 9*3 = 51
How can I make the program output 1*2 + 2*4 + 7*2 + 9*3?
At the input I received a list of numbers and the total amount to be received.
And gave back the expression.
Answer the question
In order to leave comments, you need to log in
The standard knapsack packing problem. On such a small scale, it is solved by direct enumeration.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question