| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
0ms, 1A, 29行, 留念#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
const int oo = 0x3f3f3f3f;
int V, F;
int Matrix[101][101];
int dp[101][101];
int main(){
scanf("%d %d", &F, &V);
for (int i = 1; i <= F; ++i) {
for (int j = 1; j <= V; ++j) {
scanf("%d", &Matrix[i][j]);
}
}
for (int i = 0; i < 101; ++i) {
fill(dp[i], dp[i] + 101, -oo);
}
dp[0][0] = 0;
for (int i = 1; i <= F; ++i) {
int Max_Val = *max_element(dp[i - 1], dp[i - 1] + i);
for (int j = i; j <= V; ++j) {
dp[i][j] = Max_Val + Matrix[i][j];
Max_Val = max(Max_Val, dp[i - 1][j]);
}
}
printf("%d\n", *max_element(dp[F], dp[F] + V + 1));
}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator