POJ
来源:互联网 发布:凤凰金融 以大数据为 编辑:程序博客网 时间:2024/06/05 23:49
#include<iostream>#include<algorithm>#include<string>#include<cstring>#include<map>#include<queue>#include<cmath>#include<stack>#include<vector>#include<cstdio>#define MAXN 33000#define INF 0x3f3f3f3f#define lmid l,m,rt<<1#define rmid m+1,r,rt<<1|1#define ls rt<<1#define rs rt<<1|1#define Mod 1000000007#define i64 __int64#define LIMIT_ULL 100000000000000000using namespace std;int dp[50000];int v[20],w[20];int main(){ int t; scanf("%d",&t); while(t--) { int n,m,year; scanf("%d%d%d",&m,&year,&n); for(int i=0;i<n;i++) { scanf("%d%d",&v[i],&w[i]); v[i]/=1000; } for(int y=1;y<=year;y++) { int sum=m/1000; memset(dp,0,sizeof(dp)); for(int i=0;i<n;i++) for(int j=v[i];j<=sum;j++) dp[j]=max(dp[j],dp[j-v[i]]+w[i]); m+=dp[sum]; } cout<<m<<endl; } return 0;}
阅读全文
0 0
- POJ
- poj
- POJ
- POJ
- poj
- poj
- POJ
- POJ
- poj
- POJ
- POJ
- POJ
- POJ
- POJ
- POJ
- POJ
- POJ
- POJ
- Xamarin.Forms 用户界面——控件——ListView——Cell 外观
- C# 应用程序自删除
- NYOJ35
- RHEL7.3(Redhat) 安装配置 ElasticSearch5.5.1、ElasticHead、kibana5.5.1、X-Pack
- 如何得心应手地运用贪心?
- POJ
- 4.Myeclipse开发Java web程序
- Java:在一个字符串中找到第一个只出现一次的字符。如输入abaccdeff,则输出b。
- 内省(Introspector) — JavaBean
- Servlet应用程序(1)----基于Servlet Controller的MVC
- 二阶指针和一阶指针实例区分
- 1.VMware安装3个ubuntu14.05
- Xamarin.Forms 用户界面——控件——ListView——List外观
- Rikka with Subset(hdu6092)