- 月饼盒
- 2016-05-17 21:59:53 @
var
i,j1,j2,n,m,max,x:longint;
s:array[0..301,0..301]of int64;
f:array[0..301]of int64;
begin
fillchar(s,sizeof(s),0);
readln(n,m);
for i:=1 to n do
for j1:=1 to m do
begin
read(x);
if x=0 then x:=-maxlongint;
s[i,j1]:=s[i-1,j1]+s[i,j1-1]-s[i-1,j1-1]+x;
end;
max:=-1;
for j1:=1 to m do
for j2:=j1 to m do
begin
f[0]:=0;
for i:=1 to n do
begin
x:=s[i,j2]-s[i,j1-1]-s[i-1,j2]+s[i-1,j1-1];
if f[i-1]>0 then f[i]:=f[i-1]+x else f[i]:=x;
if f[i]>max then max:=f[i];
end;
end;
write(max);
end.
0 条评论
目前还没有评论...