How to realize knapsack dynamic Planning with Java
This article mainly explains "how to achieve knapsack dynamic planning with Java". Interested friends may wish to have a look. The method introduced in this paper is simple, fast and practical. Next let the editor to take you to learn "Java how to achieve knapsack dynamic planning" bar!
Knapsack problem
[topic description]
A traveler has a backpack that can hold up to MM kilograms. Now he has nn items. Their weights are W1 and W2, respectively. WnW1,W2,... , Wn, their values are C1 and C2, respectively. CnC1,C2,... Cn, ask the traveler to get the maximum total value.
[input]
First line: two integers, MM (knapsack capacity, M