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

Re:昨晚动态凌晨2:30,郁闷了。今天这题,一次编译,一次提交AC了,情绪一下子就爆发了。贴出代码(还可优化)

Posted by 99520845 at 2010-08-20 22:10:56 on Problem 1157
In Reply To:昨晚动态凌晨2:30,郁闷了。今天这题,一次编译,一次提交AC了,情绪一下子就爆发了。贴出代码 Posted by:99520845 at 2010-08-20 22:09:40
> #include<stdio.h>
> int op[2][102];
> int max;
> int a[102][102];
> int main()
> {
> 	int f,v;
> 	int i,j;
> 	while(scanf("%d%d",&f,&v)!=EOF)
> 	{
> 		for(i=0;i<f;i++)
> 			for(j=0;j<v;j++)
> 				scanf("%d",&a[i][j]);
> 		for(i=0;i<f;i++)
> 		{
> 			max=-100;
> 			for(j=i;j<=v-f+i;j++)
> 			{
> 				if(i==0)
> 					op[i][j]=a[0][j];
> 				else
> 				{
> 					if(op[(i-1)%2][j-1]>max)
> 						max=op[(i-1)%2][j-1];
> 					op[i%2][j]=max+a[i][j];
> 				}
> 			}
> 		}
> 		max=0;
> 		for(i=v-f;i<v;i++)
> 		{
> 			if(op[(f-1)%2][i]>max)
> 				max=op[(f-1)%2][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