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 sunpy at 2008-06-11 12:40:48 on Problem 1157
#include<stdio.h>

#define N 100

int main()
{
	int a[N][N];// aesthetic values in each vase
	int s[N][N]={0};//maximize the sum of aesthetic values for the subarrangement
	int v,f;//the number of vases ,the bunches of flowers
	int i,j,k,max;
	scanf("%d%d",&f,&v);
	for(i=0;i<f;i++)
		for(j=0;j<v;j++)
			scanf(" %d",*(a+i)+j);//get the aesthetic values
	for(i=0;i<v;i++)
		s[0][i]=a[0][i];
	for(i=1;i<f;i++)
		for(j=i;j<=i+v-f;j++)//for(j=i;j<i+f;j++)
		{
			max=0;
			for(k=i-1;k<j;k++)
				if(max<s[i-1][k])
					max=s[i-1][k];
			s[i][j]=a[i][j]+max;
		}
	for(i=f-1;i<v;i++)
		if(max<s[f-1][i])
			max=s[f-1][i];
	printf("%d\n",max);
	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