Each item has two kinds of C1 and C2, requested the cost no more than target1 and target2 respectively, each item number is unrestricted, the following code output the maximum value, but how should I do is installed output which items and the number of each item? O complete code!
C1=,2,6,7,1,4,9,5 [3]
C2=,2,4,6,7,3,8,5 [6]
V=,3,5,8,3,1,6,9 [6]
Target1=20
Target2=25
N=len (C1)
F=[[0] * (target2 + 1) for I in range (0, target1 + 1)]
For I in range (0, n) :
For j in range (C1 [I], target1 + 1) :
The for m in range (C2 [I], target2 + 1) :
F [j] [m]=Max (F [j] [m], F [j - C1 [I]] [m - C2 [I]] + V [I])
Print (F [target1] [target2])