RQNOJ 15采药(0/1背包)
摘要:1 /* 2 * 0/1背包 3 */ 4 #include <cstdio> 5 #include <cstring> 6 #include <iostream> 7 8 using namespace std; 9 10 const int N = 105;11 const int M = 1005;12 13 int f[M];14 struct pack {15 int cost;16 int value;17 }p[N];18 19 void ZeroOnePack(int n, int cost, int value) {20 for (int
阅读全文
posted @
2012-05-16 20:43
Try86
阅读(145)
推荐(0)
RQNOJ 2开心的金明(0/1背包)
摘要:1 /* 2 * 0/1背包 3 */ 4 #include <cstdio> 5 #include <cstring> 6 #include <iostream> 7 8 using namespace std; 9 10 const int M = 30;11 const int N = 30005;12 13 int f[N];14 struct pack {15 int cost;16 int value;17 }p[M];18 19 void ZeroOnePack(int n, int cost, int value) {20 for (int
阅读全文
posted @
2012-05-16 20:33
Try86
阅读(166)
推荐(0)