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

who can give me some powerful testdata?

Posted by Lucifer at 2005-08-05 22:05:25 on Problem 1050
不知道哪儿错了,谁能给我几组测试数据?多谢多谢
#include <iostream.h>
#include <memory.h>
int main()
{
	int i,n,map[222][222],max[222][222],max2[222][222],t,k,p;
	memset(map,0,sizeof(map));
	memset(max2,0,sizeof(max2));
	cin>>n;
	for (i=1;i<=n;i++)
		for (p=1;p<=n;p++)

		cin>>map[i][p];
	if (n==1) {cout<<map[1][1]<<endl; return 0;}
	for (i=1;i<=n;i++)
	{
		memset(max,0,sizeof(max));
		for (k=1;k<=n;k++) max[k][k]=map[i][k];
		for (k=1;k<=n-1;k++)
			for (p=k+1;p<=n;p++)
			{
				max[k][p]=max[k][p-1]+map[i][p];
			}
		for (k=1;k<=n;k++)
			for (p=1;p<=n;p++)
				{
					max2[k][p]+=max[k][p];
					if (max2[k][p]<0) max2[k][p]=0;
				}
	}
	t=0;
	for (i=1;i<=n;i++)
		for (p=1;p<=n;p++)
			if (max2[i][p]>t) t=max2[i][p];
	if (t==0) t=-1000000;
	for (i=1;i<=n;i++)
		for (p=1;p<=n;p++)
			if (map[i][p]>t) t=map[i][p];
	cout<<t<<endl;
	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