请求加强数据

P1295 [TJOI2011] 书架

@[小粉兔](/user/10703)
by seantheone @ 2022-10-17 08:57:08


@[VinstaG173](/user/59388)
by seantheone @ 2022-10-17 08:58:28


@[seantheone](/user/456790) 能给下您代码吗(
by XKqwq @ 2022-10-17 09:03:31


qwq
by XKqwq @ 2022-10-17 09:03:39


@[jacobigSB](/user/572558) 我用 @[El_destructor](/user/195198) 那个号交的,代码: ```cpp #include <bits/stdc++.h> // 省略了缺省源 using namespace std; const int MAXN=100005; int h[MAXN],pre[MAXN]; int dp[MAXN]; int main(){ int n,m; read(n,m); for(int i=1;i<=n;i++) read(h[i]),pre[i]=pre[i-1]+h[i]; memset(dp,0x3f,sizeof(dp)); dp[0]=0; for(int i=1;i<=n;i++){ int maxn=-1e9; for(int j=i;j>=1 && pre[i]-pre[j-1]<=m;j--) maxn=max(maxn,h[j]),dp[i]=qmin(dp[i],dp[j-1]+maxn); } write(dp[n]); return flush(),0; } ```
by seantheone @ 2022-10-17 11:16:15


呼叫管理 QaQ @[expect2004](/user/28910)
by seantheone @ 2022-10-17 18:13:05


@[dottle](/user/79067)
by 小粉兔 @ 2022-10-18 01:48:50


|