【hautoj1307】CF
来源:互联网 发布:java axis2 webservice 编辑:程序博客网 时间:2024/05/16 09:53
传送门:点击打开链接
题目描述
LYD loves codeforces since there are many Russian contests. In an contest lasting for T minutes there are n problems, and for the ith problem you can get ai−di∗ti points, where ai indicates the initial points, di indicates the points decreased per minute (count from the beginning of the contest), and ti stands for the passed minutes when you solved the problem (count from the begining of the contest).
Now you know LYD can solve the ith problem in ci minutes. He can't perform as a multi-core processor, so he can think of only one problem at a moment. Can you help him get as many points as he can?
输入
The first line contains two integers n,T(0≤n≤2000,0≤T≤5000).
The second line contains n integers a1,a2,..,an(0<ai≤6000).
The third line contains n integers d1,d2,..,dn(0<di≤50).
The forth line contains n integers c1,c2,..,cn(0<ci≤400).
输出
Output an integer in a single line, indicating the maximum points LYD can get.
样例输入
3 10
100 200 250
5 6 7
2 4 10
样例输出
254
#include <bits/stdc++.h>using namespace std;typedef long long LL;struct node{ int a,c,d; double m;} q[2005];bool cmp(node x,node y){ if(x.m==y.m) return x.c<y.c; return x.m>y.m;}int dp[5005];int main(){ int i,n,t; cin>>n>>t; for(i=1; i<=n; i++) scanf("%d",&q[i].a); for(i=1; i<=n; i++) scanf("%d",&q[i].d); for(i=1; i<=n; i++) { scanf("%d",&q[i].c); q[i].m=q[i].d*1.0/q[i].c; } sort(q+1,q+1+n,cmp); int maxx=0; for(int i=1; i<=n; i++) for(int j=t; j>=q[i].c; j--) { dp[j]=max(dp[j],dp[j-q[i].c]+q[i].a-q[i].d*j); maxx=max(dp[j],maxx); } printf("%d\n",maxx); return 0;}
- 【hautoj1307】CF
- CF
- CF
- cf
- cf
- CF
- CF
- CF
- CF
- CF
- CF
- cf
- CF
- cf
- cf
- cf ***
- CF
- CF
- 形参和实参
- 转载 DM9000的调试
- (六)整合spring cloud云服务架构
- HTML5的市场状况
- 实验二 线性表综合实验之《双链表》
- 【hautoj1307】CF
- 高并发系统的瓶颈与优化总结
- 跨语言RPC框架Thrift详解
- JavaBean
- JSON
- C语言之指针专题三:理解指针要和内存四区模型和函数调用模型相结合
- ACM ICPC 2017 Warmup Contest 2(ACM Northeastern European Regional Contest,Northern Subregion 2016)
- BlockingQueue 接口详解
- DOM艺术前六章范例:图片仓库