且未

博客园 首页 新随笔 联系 订阅 管理

2018年8月2日 #

摘要: 问题描述已知:有一个容量为V的背包和N件物品,第i件物品的重量是weight[i],价值是cost[i]。问:在不超过背包容量的情况下,最多能获得多少价值。01背包的特点:每种物品只有一件,可以选择放或者不放1子问题:f[i][v] 表示前i件物品放到一个容量为v的背... 阅读全文
posted @ 2018-08-02 16:37 阿聊 阅读(95) 评论(0) 推荐(0)

摘要: Bellman-ford:/*bellman ford*/#include #include #include using namespace std;const int INF = 0x3f3f3f3f;const int Max = 9999;typedef st... 阅读全文
posted @ 2018-08-02 10:57 阿聊 阅读(88) 评论(0) 推荐(0)

摘要: 题目spfa: #include using namespace std;const int maxn = 205;const int INF = 0x3f3f3f3f;vector > E[maxn];int n,m;int d[maxn],inq[maxn];/... 阅读全文
posted @ 2018-08-02 10:51 阿聊 阅读(97) 评论(0) 推荐(0)