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:一种解法.

Posted by adetwo at 2010-07-14 15:13:25 on Problem 1050
In Reply To:一种解法. Posted by:silvere at 2006-03-23 00:59:13
3
-1 -2 -3
-4 -5 -6
-7 -8 -9
结果为0,不是错了嘛……

> #include <stdio.h>
> #include <stdlib.h>
> 
> int main()
> {
> 	int c,res=0,k;
> 	int d[100][100];
> 	int s[101],a[100];
> 	while(scanf("%d",&c)==1)
> 	{
> 		for(int i=0;i<c;i++)
> 		{
> 			for(int j=0;j<c;j++)
> 			{
> 				scanf("%d",&d[i][j]);
> 			}
> 		}
> 		for(int i=0;i<c;i++)
> 		{
> 			for(int j=(i+1);j<c;j++)
> 			{
> 				s[0]=0;
> 				for(int l=0;l<100;l++)
> 				{
> 					a[l]=0;
> 					s[l]=0;
> 				}
> 				for(k=0;k<c;k++)
> 				{
> 					for(int m=i;m<=j;m++)
> 						a[k]+=d[m][k];
> 					if(s[k]>=0)
> 						s[k+1]=s[k]+a[k];
> 					else
> 						s[k+1]=a[k];
> 				}
> 				for(int i=0;i<k;i++)
> 				{
> 					if(res<s[i])
> 						res=s[i];
> 				}
> 			}
> 		}
> 		printf("%d",res);
> 	}
> }

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