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 njjinni at 2006-03-23 19:44:00 on Problem 1050
In Reply To:一种解法. Posted by:silvere at 2006-03-23 00:59:13
> #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