摘要: 题目:http://poj.org/problem?id=1276题意:费用和价值相同的多重背包。以前看背包的时候做过,今天又做了一遍。二进制优化代码 1 #include 2 #include 3 #include 4 using namespace std; 5 6 int _max(int ... 阅读全文
posted @ 2013-10-14 21:23 水门 阅读(163) 评论(0) 推荐(0) 编辑
摘要: 题目:http://poj.org/problem?id=1837题意:求平衡状态, c个位置,g个物体重量,求有多少种平衡状态。 1 #include 2 #include 3 #include 4 using namespace std; 5 6 int main() 7 { 8 int c,g,d[25][15000],h[25],w[25];//d 的第一个代表物品个数,第二个代表现在的平衡状态,>7500为向右偏 9 cin>>c>>g;10 for(int i=1; i>h[i];12 for(int i=1; i>w[i];14 mems 阅读全文
posted @ 2013-10-14 19:09 水门 阅读(149) 评论(0) 推荐(0) 编辑