动态规划 背包问题 poj 1837 Balance
来源:互联网 发布:thomson数据库 编辑:程序博客网 时间:2024/05/16 17:30
#include<cstdio>#include<cstring>#include<iostream>using namespace std;int dp[25][15010];int main(){ int n,g; int c[30]; int w[30]; cin>>n>>g; for(int i=1;i<=n;++i){ cin>>c[i]; } for(int i=1;i<=g;++i){ cin>>w[i]; } memset(dp,0,sizeof(dp)); dp[0][7500]=1; for(int i=1;i<=g;++i){ for(int j=0;j<=15000;++j){ if(dp[i-1][j]){ for(int k=1;k<=n;++k){ dp[i][j+c[k]*w[i]]+=dp[i-1][j]; } } } } cout<<dp[g][7500]<<endl;}
阅读全文
0 0
- 动态规划 背包问题 poj 1837 Balance
- POJ 1837:Balance:动态规划_背包问题变形
- POJ 1837 Balance(动态规划之背包问题)
- POJ 1837 Balance(01背包 动态规划)
- POJ 1837 Balance [动态规划——完全背包]
- POJ 1837-Balance 动态规划
- POJ 1837 Balance(DP动态规划)
- POJ 1837 Balance (动态规划)
- POJ 1837 Balance (动态规划)
- POJ 1837Balance(动态规划 好题)
- poj 1837 Balance(动态规划)
- POJ 1837 Balance(01背包问题)
- poj 1837 Balance(背包)
- poj 1837 Balance(01背包)
- poj 1837 Balance--01背包
- poj 1837 Balance 01背包
- poj 1837 Balance (01背包)
- poj 1837 Balance(背包)
- 【学习笔记】vue-router路由的两种实现机制
- Primer (十)
- Hibernate-集合映射
- 不用手机号码怎么注册微信号
- 接口的调用与调用别人的接口
- 动态规划 背包问题 poj 1837 Balance
- 工程师的调试法宝之Printf串口输出
- 51nod1277 字符串中的最大值(KMP)
- Girls and Boys
- JAVA学习笔记_利用slf4j进行log4j日志管理
- oracle学习历程 2017/8/21
- 浏览器支持的几种URL
- 【计算机网络】计算机网络的性能
- 二进制、源码安装的方式mysql卸载