- 传送门
- 看着这道题是不是特别眼熟?没错,我又做过。
- 就是这一道鱼塘钓鱼(fishing),对没错我还写过题解
- 还能怎么办?重写吧
- 思路一致,有一个小细节,题干给出的H是按照小时计,而其他时间都是按照5分钟计算,需要进行换算。
代码
#include<bits/stdc++.h>
using namespace std;
int a[110],b[110],c[110];
priority_queue<pair<int,int> >q;
int main()
{
int n,,w=0,ans=0;
scanf("%d%d",&n,&T);
T*=12;
for(int i=1;i<=n;i++)
scanf("%d",&a[i]);
for(int i=1;i<=n;i++)
scanf("%d",&b[i]);
for(int i=1;i<n;i++)
scanf("%d",&c[i]);
for(int i=1;i<=n;i++){
int t=T-w,y=0;
while(!q.empty())q.pop();
for(int j=1;j<=i;j++)
q.push(make_pair(a[j],j));
while(t>0&&q.top().first>0){
pair<int,int>x;
x=q.top();q.pop();
y+=x.first;
x.first-=b[x.second];
q.push(x);
t--;
}
ans=max(ans,y);
w+=c[i];
}
cout<<ans<<endl;
return 0;
}