poj 3624 最基本01背包问题
来源:互联网 发布:仓廪实而知礼节 编辑:程序博客网 时间:2024/06/05 03:09
#include <iostream>#include<cstring>#include <stdio.h>using namespace std;#define MAX_V (4000+1)#define MAX_F (13000+1)int n,m;int W[MAX_V];int D[MAX_V];int F[MAX_F];int main(){while(cin>>n>>m){for(int i=1;i<=n;i++){cin>>W[i]>>D[i];}memset(F,0,sizeof(F));for(int i=1;i<=n;i++){for(int v=m;v>=W[i];v--){if( F[ v - W[i] ] + D[i] > F[v])F[v] = F[ v - W[i] ] + D[i];}}int maxi = -1;for(int v=m;v>=0;v--)if(F[v] > maxi)maxi = F[v];cout<<maxi<<endl;}}
- poj 3624 最基本01背包问题
- [背包] poj 3624 最基本的背包问题
- 01背包问题 poj 3624
- POJ 3624 01背包问题
- Poj-3624 背包问题
- poj 3624 Charm Bracelet 01背包问题
- POJ 3624 Charm Bracelet 01背包问题
- 01背包问题:poj 3624 Charm Bracelet
- POJ 3624Charm Bracelet (01背包问题)
- 01背包问题-基本实现
- 回顾基本01背包问题
- 经典背包问题 POJ 3624
- poj 3211 01背包问题
- poj 3628 01背包问题
- POJ 2184 01 背包问题
- Dividing+POJ+01背包问题
- 01 背包 poj 3624
- poj 3624 01背包
- 算法导论 DP 矩阵链乘法
- jquery控制动态生成的gridview中多列checkbox的全选反选及自动判断是否全选状态
- (apple官方文档译文)表视图样式和扩展视图-Table View Styles and Accessory Views
- UIViewController的跳转方式
- CodeForces 141B - Hopscotch
- poj 3624 最基本01背包问题
- 边看边写(判断一个序列是否为出栈序列)
- centos 修改系统时间
- ACE前摄器Proactor模式
- 关于android开发中手机连接不上eclipse问题
- Conexant声卡实现内录功能(win7)
- 双向链表的建立/测长/打印
- 6410 实现 linux 串口驱动详解
- Java基础_DOS命令、Java跨平台性、技术架构、环境搭建和运行、注释、需求分析