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 speedcell4 at 2013-04-17 20:33:45 on Problem 1050
const int MAXV = 101;

int n,a[MAXV][MAXV],sum[MAXV][MAXV];

int main()
{
    while(IN(n))
    {
    	MEM(sum,0);
    	FOR(i,1,n) FOR(j,1,n)
    	{
    	    IN(a[i][j]);
    	    sum[i][j]=a[i][j]+sum[i][j-1];
    	}
    	int ans=0,temp=0;
    	FOR(j,0,n) FOR(k,j,n)
    	{
    	    temp=0;
    	    FOR(i,1,n)
    	    {
    	        temp+=sum[i][k]-sum[i][j];
    	        ans=max(ans,temp=max(temp,0));
    	    }
    	}
    	OL(ans);
    }

    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