Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

为什么WA的总是我?

Posted by MasterLuo at 2009-07-23 16:30:42 on Problem 1157
#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:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator