Pregunta de entrevista de Blackhawk Network

One DP problem can be solved by unbounded knapsack, just need to tweak a bit.