CF467C George and Job
Posted lovewhy
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了CF467C George and Job相关的知识,希望对你有一定的参考价值。
#include<iostream> #include<cstdio> #include<cstring> #include<cmath> #include<algorithm> #include<queue> using namespace std; const int N=5e3+5; int n,m,k; long long p[N]; long long sum[N]; long long dp[N][N]; int main() { scanf("%d%d%d",&n,&m,&k); for(int i=1;i<=n;++i) { scanf("%lld",p+i); sum[i]=sum[i-1]+p[i]; } for(int i=m;i<=n;++i) { for(int j=1;j<=k;++j) { dp[i][j]=max(dp[i-1][j],dp[i-m][j-1]+sum[i]-sum[i-m]); } } int ans=-1; printf("%lld",dp[n][k]); return 0; }
以上是关于CF467C George and Job的主要内容,如果未能解决你的问题,请参考以下文章
Codeforces Round #267 (Div. 2) C. George and Job
CF877E Danil and a Part-time Job 线段树维护dfs序
Nginx——Nginx启动报错Job for nginx.service failed because the control process exited with error code(代码片段
Codeforces 387E George and Cards
Codeforces Round #227 (Div. 2) / 387C George and Number (贪心)