(Before you answer with a link to another SO question or close it as a duplicate, read the question carefully. This is different from the standard version of this problem, and I searched for a long time, so I'm pretty sure there is no such question)
I need to find if the smallest possible S , which is the sum of some subset of X [i] , which is > = T (some target value less than the sum of the complete set).
The set is not very large (about 40 elements), but still too large for an exponential solution to reverse tracing.
the numbers and the amount are huge (about 10 ^ 15), so dynamic programming will not work (the number of possible states is large, so the memory table will end soon in the notes table).
For the same reason, the Pisinger linear time algorithm will not work (this is O (nr), where r is the upper bound of the sum, which in this case is too large).
Is there any deterministic algorithm that will help me in this case with a large sum, but few digits? I do not want to resort to some approximation algorithms.
source share