title: Variation on knapsack - minimum total cost with exact weight
body: <p>There are types of items (N types), each have weight wi and cost ci. There are an infinite number of each. The problem is to make a knapsack with EXACT (W) weight and minimum total cost of items. I know I should use dynamic in this case, but it's not a usual knapsack problem and I can't find the relation. I also found some similar questions, but I haven`t understood theese solutions. Here are the links <a href="https://stackoverflow.com/questions/7949705/variation-on-knapsack-minimum-total-value-exceeding-w?rq=1">1</a>, <a href="https://stackoverflow.com/questions/15457143/knapsack-with-minimum-cost/15457546?noredirect=1#comment21873666_15457546">2</a>.
  How to use DP to solve it?</p>