但是,因为还要准备 NOIP2013, z老师只给了他 H 个小时的空余时间,假设有 n 个鱼塘都在一条水平路边,从左边到右编号为 1, 2, 3 … n 。
VIP是个很讲究效率的孩子,他希望用这些时间钓到尽量多的鱼。他从湖1出发,向右走,有选择的在一些湖边停留一定的时间钓鱼,最后在某一个湖边结束钓鱼。他测出从第 i 个湖到 i+1个湖需要走 5×ti 分钟的路,还测出在第 i 个湖边停留,第一个5分钟可以钓到鱼 fi,以后再每钓5分钟鱼,鱼量减少 di。为了简化问题,他假定没有其他人钓鱼,也不会有其他因素影响他钓到期望数量的鱼。请编程求出能钓最多鱼的数量。
// Problem: P1717 钓鱼 // Contest: Luogu // URL: https://www.luogu.com.cn/problem/P1717 // Memory Limit: 125 MB // Time Limit: 1000 ms // // Powered by CP Editor (https://cpeditor.org)
#include<bits/stdc++.h> usingnamespace std; //#define int long long inlineintread(){int x=0,f=1;char ch=getchar(); while(ch<'0'||ch>'9'){if(ch=='-')f=-1; ch=getchar();}while(ch>='0'&&ch<='9'){x=(x<<1)+ (x<<3)+(ch^48);ch=getchar();}return x*f;} //#define M //#define mo #define N 30 structnode { int x, k; booloperator <(const node &A) const { return k<A.k; } }p; int n, m, i, j, k; int ans, h; int f[N], d[N], t[N], s[N]; priority_queue<node>q;