poj 2063 Investment 背包
来源:互联网 发布:d3.js 绘制 编辑:程序博客网 时间:2024/05/29 07:01
水题,唯一要注意的就是你要进行n年,每年的初始化金币不一样。算一每年要算一遍
#include<cstdio>#include<iostream>#include<algorithm>#include<cstring>using namespace std;int dp[100000],w[1000],pi[1000];int main(){ int T; scanf("%d",&T); while(T--) { int n,m; scanf("%d %d",&n,&m); int d; scanf("%d",&d); for(int i=0;i<d;i++) { scanf("%d %d",&w[i],&pi[i]); w[i]/=1000; } for(int i=0;i<m;i++) { int s=n/1000; memset(dp,0,sizeof(dp)); for(int j=0;j<d;j++) for(int k=w[j];k<=s;k++) dp[k]=max(dp[k],dp[k-w[j]]+pi[j]); n+=dp[s]; } printf("%d\n",n); } return 0;}
0 0
- POJ--2063--Investment--背包
- poj 2063 Investment 背包
- poj 2063 Investment 完全背包
- Poj 2063 Investment (完全背包)
- POJ 2063 Investment 完全背包
- poj 2063 Investment 完全背包
- poj 2063 Investment (完全背包)
- POJ 2063 Investment 完全背包
- POJ 2063 Investment 完全背包
- POJ 2063 Investment (完全背包)
- Investment 完全背包 POJ 2063
- POJ 2063 Investment (完全背包)
- POJ-2063--Investment (完全背包)
- POJ 2063 Investment(完全背包)
- POJ - 2063 Investment(01背包)
- POJ 2063 Investment(完全背包+)
- POJ 2063 Investment 完全背包
- poj 2063 Investment ( zoj 2224 Investment ) 完全背包
- eclipse在线安装weblogic server
- Unity3D游戏开发之如何减少安装包大小
- ResponsiveSlides javascript 幻灯片插件
- 改进file_operate
- hashcode和equals的使用
- poj 2063 Investment 背包
- 实用的一些mysql数据库操作
- redis 学习笔记(5)-Spring与Jedis的集成
- npm安装一些包失败了
- 判断某数据库某表是否存在object_id
- android开机默认中文的方法
- wince MFC 中常用的数据转换
- OpenSSL源码分析之MD5算法
- Q10:fatal error:use of unimplemented initializer init(nibName nibNameOrNil: String?, bundle nibBundl