| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
AC,贴代码,贡献解题报告~~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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator