【CF】 467C George and Job DP
2014-09-19 19:27
405 查看
DP[ i ][ j ] 表示在1-j 间取了i组数
#include <stdio.h> #include <string.h> #include <stdlib.h> #include <string> #include <iostream> #include <algorithm> #include <sstream> #include <math.h> using namespace std; #include <queue> #include <stack> #include <vector> #include <deque> #include <set> #include <map> #define cler(arr, val) memset(arr, val, sizeof(arr)) #define IN freopen ("in.txt" , "r" , stdin); #define OUT freopen ("out.txt" , "w" , stdout); typedef long long LL; const int MAXN = 5040;//点数的最大值 const int MAXM = 20006;//边数的最大值 const int INF = 0x3f3f3f3f; const int mod = 10000007; LL a[MAXN],dp[MAXN][MAXN]; int main() { int n,m,k; //IN; while(scanf("%d%d%d",&n,&m,&k)!=EOF) { a[0]=0; for(int i=1;i<=n;i++) { scanf("%lld",&a[i]); a[i]+=a[i-1]; } cler(dp,0); for(int i=1;i<=k;i++) { for(int j=m;j<=n;j++) { dp[i][j]=max(dp[i-1][j-m]+a[j]-a[j-m],dp[i][j-1]); // cout<<i<<' '<<j<<' '<<dp[i][j]<<endl; } } cout<<dp[k] <<endl; } return 0; }
相关文章推荐
- 【CF】 467C George and Job DP
- Codeforces 467C George and Job(dp)
- cf_467C_George and Job
- Codeforces 467C George and Job(dp)
- Codeforces 467C George and Job(dp)
- Codeforces Round #267 (Div. 2)467C George and Job(dp)
- Codeforces 467C George and Job DP
- codeforces 467C George and Job dp
- codeforces 467C George and Job dp
- Codeforces 467C George and Job(DP)
- codeforces 467C George and Job(简单dp,看了题解抄一遍)
- Codeforces 467C George and Job(dp)
- codeforces 467CGeorge and Job
- Codeforces Round #267 (Div. 2) C. George and Job DP
- Codeforces 467C George and Job(动态规划)
- CodeForces - 467C George and Job
- CF 467C - George and Job (简单区间DP)
- Codeforces 467C. George and Job
- Codeforces Round #267 (Div. 2) C. George and Job
- [CF752E]Santa Claus and Tangerines(二分答案,dp)