PersonalCorpus 版 (精华区)
275969 12:15:25 13 Nov 2002 Bozhang,HIT,P.R.China
1146 Pascal Accepted 0.04 sec 221K
program p1146_2;
{$APPTYPE CONSOLE}
uses
SysUtils;
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)
页面执行时间:3.146毫秒