1 #include <iostream>
2 using namespace std;
3 #define MaxSize 104
4 int mapmap[MaxSize][MaxSize];
5 int n,Max;
6
7 int main(){
8 //freopen("in.txt","r",stdin);
9 int i,j,k;
10 while (~scanf("%d",&n)){
11 memset(mapmap,0,sizeof(mapmap));
12 Max=-128;
13 int val;
14 for(i=1;i<=n;i++)
15 for(j=1;j<=n;j++){
16 scanf("%d",&val);
17 mapmap[i][j]=mapmap[i][j-1]+val;
18 }
19 for(i=1;i<=n;i++){//逐列扫描
20 for(j=i;j<=n;j++){
21 int sum=0;
22 for(k=1;k<=n;k++){//逐行扫描
23 sum=(sum>0?sum:0)+mapmap[k][j]-mapmap[k][i-1];
24 if(sum>Max) Max=sum;
25 }
26 }
27 }
28 printf("%d\n",Max);
29 }
30 return 0;
31 }
posted on 2012-07-09 15:56
Leo.W 阅读(163)
评论(0) 编辑 收藏 引用