首页 > TAG信息列表 > HDU1114

HDU1114 Piggy-Bank (完全背包)

完全背包模板,和01背包相比不用倒推,因为一种可以选多个。 这道题求最小,dp数组初始化为无穷即可。 1 #include<iostream> 2 #include<cstring> 3 #include<algorithm> 4 using namespace std; 5 const int M=10005; 6 const int INF=0x3f3f3f; 7 int dp[M];//dp[j]表示放入