| ||||||||||
| 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 | |||||||||
为什么WA的总是我?#include <iostream>
#include <cmath>
#include <cstdio>
#include <vector>
using namespace std;
int F, V;
int value[101][10];
int best[101][101];
#define MIN -10000000
int main() {
while(scanf("%d%d", &F, &V) != EOF) {
for(int i = 0; i < F; ++i) {
for(int j = 0; j < V; ++j) {
scanf("%d", &value[i][j]);
best[i][j] = MIN;
}
}
for(int i = 0; i < V; ++i)
best[0][i] = value[0][i];
for(int i = 1; i < F; ++i) {
int maxs = best[i - 1][i - 1];
for(int j = i; j < V; ++j) {
best[i][j] = value[i][j] + maxs;
maxs = (maxs < best[i - 1][j] ? best[i - 1][j] : maxs);
}
}
int ans = MIN;
for(int i = F - 1; i < V; ++i) {
if(best[F - 1][i] > ans)
ans = best[F - 1][i];
}
printf("%d\n", ans);
}
return 0;
}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator