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

AC,贴代码,贡献解题报告~~

Posted by yingxiang720 at 2011-03-30 10:34:28 on Problem 1050
http://blog.sina.com.cn/s/blog_63509b890100qxmr.html
#include <iostream>
#define MIN -9999999
using namespace std;

int cmax(int a,int b)   {return a > b ? a : b;}
int v[110][110],sum[110];

int main()
{
    int n,i,j,k,l,smax;
    while(scanf("%d",&n) != EOF)
    {
        for(i = 0;i < n;i++)
            for(j = 0;j < n;j++)
                scanf("%d",&v[i][j]);
        smax = 0;
        for(i = 0;i < n;i++)
        {
            memset(sum,0,sizeof(sum));
            for(j = i;j < n;j++)
            {
                for(k = 0;k < n;k++)
                    sum[k] += v[j][k];
                int b = 0;
                for(l = 0;l < n;l++)
                {
                    if(b > 0)   b += sum[l];
                    else    b = sum[l];
                    if(b > smax)    smax = b;
                }
            }
        }
        printf("%d\n",smax);
    }
    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