@YYR RE最后一个点,求助,,,,

P1417 烹调方案

Sshenyyyu @ 2018-10-31 21:07:12

#include <cstdio>
#include <cmath>
#include <deque>
#include <stack>
#include <queue>
#include <cmath>
#include <cstring>
#include <algorithm>
#include <iostream>
using namespace std;
#define ll long long
#define ull unsigned long long

const int Maxn=100001;
const int inf=2147483647;

ll n,m,T;
ll f[Maxn];
struct node { ll a,b,c; }p[Maxn];
bool cmp(node a,node b) {
    return a.c*b.b<=b.c*a.b;
}   
ll ma(ll a,ll b) { return a>b?a:b; }
int main() {
    scanf("%lld%lld",&T,&n);
    for(ll i=1; i<=n; i++) scanf("%lld",&p[i].a);
    for(ll i=1; i<=n; i++) scanf("%lld",&p[i].b);
    for(ll i=1; i<=n; i++) scanf("%lld",&p[i].c);
    sort(p+1,p+n+1,cmp);
    f[0]=0;
    for(ll i=1; i<=n; i++)
        for(ll j=T; j>=p[i].c; j--) 
            f[j]=max(f[j],f[j-p[i].c]+p[i].a-(j*p[i].b));
    ll ans=0;
    for(ll i=1; i<=T; i++)
        ans=ma(ans,f[i]);
    printf("%lld\n",ans);
    return 0;
}

by Sshenyyyu @ 2018-10-31 22:20:19

看到我博客里可爱的小人了吗


by Limerick @ 2018-10-31 22:21:00

@Fitzwilliam_Darcy 怪我咯


by Sshenyyyu @ 2018-10-31 22:22:04

看到了吗?


by Limerick @ 2018-10-31 22:22:34

看到了,你这烧饼

@Fitzwilliam_Darcy


by Sshenyyyu @ 2018-10-31 22:23:59

可爱吧,搞了一中午


by Sshenyyyu @ 2018-10-31 22:24:10

@Fitzwilliam_Darcy 才搞好


by Limerick @ 2018-10-31 22:24:33

你老@ 你自己干嘛


by Limerick @ 2018-10-31 22:24:43

果然是烧饼


by Sshenyyyu @ 2018-10-31 22:26:43

@wang_tian_yi 你也是个烧饼


by Limerick @ 2018-10-31 22:29:09

@Fitzwilliam_Darcy

我们俩别争了,谁也没有@双管极光灯

这位烧饼


上一页 | 下一页