PersonalCorpus 版 (精华区)
1236040 Big Guava ... 108 Accepted
0:00.023 64 2002/11/14 04:51:35.892
var
a:array[0..100,0..100] of integer;
i,j,k,m,n,best:integer;
function readnum:integer;
begin
while eoln(input) do readln;
read(result);
end;
begin
{$IFNDEF ONLINE_JUDGE}
assign(input,'input1146.txt');reset(input);
assign(output,'output1146.txt');rewrite(output);
{$ENDIF}
readln(n); fillchar(a,sizeof(a),0);
for i:=1 to n do for j:=1 to n do a[i,j]:=readnum;
for j:=1 to n do for i:=2 to n do a[i,j]:=a[i,j]+a[i-1,j];
best:=-maxint;
for k:=1 to n do
for i:=0 to n-k do begin
m:=0;
for j:=1 to n do begin
m:=m+a[i+k,j]-a[i,j];
if (m<0) then m:=0;
if (m>best) then best:=m;
end;
end;
writeln(best);
end.
Powered by KBS BBS 2.0 (http://dev.kcn.cn)
页面执行时间:2.702毫秒