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

大牛们帮我看看吧

Posted by chuizi_nudt at 2006-06-21 15:58:37 on Problem 1157
想写成o(F*V)的,可是失败了。恳请大牛们批评指正,不胜感谢
#include <stdio.h>
#include <string.h>
int main()
{
	int dp[2][101],f,t,v,i,ii;
	bool flag=false;
	scanf("%d%d",&f,&v);
	t=f;
	memset(dp,0,sizeof(dp));
	ii=1;
	while(t--)
	{
		for(i=0;i<v;i++)
		{
			scanf("%d",&dp[ii][i]);
			if(flag&&dp[1-ii][i-1]>0)
					dp[ii][i]+=dp[1-ii][i-1];
			if(i>f-t-1&&dp[ii][i-1]>dp[ii][i])
					dp[ii][i]=dp[ii][i-1];
			flag=true;
		}
		ii=1-ii;
	}
	printf("%d\n",dp[1-ii][v-1]);
	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