1 条题解
-
0Guest LV 0 MOD
-
0
#include<bits/stdc++.h> using namespace std; int n,s,t,m,a[1001],f[1001]; int main() { // freopen("gold.in","r",stdin); // freopen("gold.out","w",stdout); cin>>m; while(m--) { memset(f,0,sizeof(f)); cin>>n; cin>>s>>t; for (int i=1; i<=n; i++) cin>>a[i]; f[1]=a[1]; for (int i=2; i<=n; i++) for (int j=s; j<=t; j++) if (i-j>0) f[i]=max(f[i],f[i-j]+a[i]); cout<<f[n]<<endl; } return 0; }
- 1