# Modified Subset Sum Problem

Given an array of $n$ integers $A$, and some value $m$, determine if it is possible, by using certain amounts of each element, to get a total sum equal to $m$. Consider that you can use any amount of any of the elements.

This is sort of like the subset sum problem, but in this case that sum can contain elements multiplied by some factor, and this factor has no upper-bound. I'm struggling quite a bit with this problem, so does anyone know how can I solve it?

• Have you tried proving that this problem is NP-complete? – Yuval Filmus Apr 29 '18 at 16:01
• No, but i don´t think it is because this is an exercise in my competitive programming class. Either that or i´m misinterpreting the problem. – Mateus Buarque Apr 29 '18 at 16:04
• If you're allowed to use negative integer amounts, then the problem is easy. Otherwise, I believe that it's NP-complete. You can try adapting the dynamic programming algorithm to solve it for small $m$. – Yuval Filmus Apr 29 '18 at 16:05
• You can reduce your problem to the usual subset sum by replacing each integer $k$ by $k,2k,4k,\ldots,2^{\lfloor \log_2 m \rfloor}k$, and now use any technique you know for subset sum (dynamic programming, meet in the middle) in order to solve your problem. – Yuval Filmus Apr 29 '18 at 18:32
• It's also not quite clear what your goal is, as you pretty much only state the problem. Do you want to give and algorithm or analyse the complexity? What have you tried and where did you get stuck? – Raphael Apr 29 '18 at 20:03