Muller25 @ 2022-11-27 12:10:31
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
using namespace std;
int a[100005],dp[100005];
int main()
{
int n,L,R;
cin>>n>>L>>R;
for(int i=0;i<=n;i++){
cin>>a[i];
dp[i]=-0x3f3f3f3f;
}dp[0]=0;
for(int i=L;i<=n;i++){
for(int j=L;j<=R;j++)
dp[i]=max(dp[i],dp[i-j]+a[i]);
}
int ans=-0x3f3f3f3f;
for(int i=n+1-R;i<=n;i++)
ans=max(dp[i], ans);
cout<<ans;
return 0;
}
by TankYu @ 2022-11-27 12:20:33
dp的i-j显然炸了