HDU2191多重背包
来源:互联网 发布:量化股票模型软件 编辑:程序博客网 时间:2024/04/29 12:49
#include <stdio.h>#include <algorithm>#include <iostream>#define M 200using namespace std;int dp[M],price[M],weight[M];int sum[M];int max(int a,int b){return a>b?a:b;}int main(){int t,n,m,i,j,k;while(~scanf("%d",&t)){while(t--){memset(dp,0,sizeof(dp));scanf("%d%d",&n,&m);for(i=1;i<=m;i++){scanf("%d%d%d",&price[i],&weight[i],&sum[i]);}for(i=1;i<=m;i++){for(j=1;j<=sum[i];j++){for(k=n;k>=price[i];k--){dp[k] = max(dp[k],dp[k-price[i]]+weight[i]);}}}printf("%d\n",dp[n]);}}return 0;}
0 0
- hdu2191(多重背包)
- hdu2191(多重背包)
- hdu2191多重背包
- HDU2191多重背包问题
- hdu2191(多重背包)
- HDU2191多重背包
- hdu2191 多重背包
- hdu2191(多重背包)
- hdu2191 多重背包问题
- DP--多重背包--HDU2191
- HDU2191 多重背包
- HDU2191(多重背包)
- HDU2191(多重背包)
- 多重背包(HDU2191)
- 二维-hdu2191-多重背包
- 多重背包 HDU2191
- hdu2191 多重背包
- HDU2191 多重背包 一题多解
- 使用fmt标签格式化输出日期和数字
- 【编译原理】TINY编译器之词法分析(二)
- Network Saboteur
- Web开发中遇到的数据传递问题(一)
- android-support-v4.jar的问题
- HDU2191多重背包
- 【cocos2d-x开发】01windows环境下搭建cocos2d-x 3.0 的基础环境
- leetcode 之 Two Sum 解题思路
- Ubuntu12.04 安装2.6.xxx内核步骤
- error:system("type d:\\1.txt");不能查看文件的内容
- HDU1114完全背包
- 第十九周工作计划表
- Android开发学习
- 结合MongoDB开发LBS应用