N
N
Nwton2017-08-17 16:47:43
Mathematics
Nwton, 2017-08-17 16:47:43

How to assemble a puzzle of numbers?

Several numbers are given [1, no). Given a key number N [1, no).
The task is to select numbers (in the range from 1 to 10) from the set in such a way that their sum is as close as possible to the given N, but not more than N.
For example, with a set of 1, 9, 3, 5, 999 and N = 4, the solution will be 1, 3
Perhaps there are ready-made algorithms for solving this? So far, stupid enumeration with sifting out numbers > N comes to mind.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
L
longclaps, 2017-08-17
@Nwton

tyts

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question