- 盖房子
- 2014-12-01 15:16:02 @
var
a,f:array[0..1001,0..1001] of int128;
x,i,j,n,m:longint; function min(a,b:longint):int128;
begin
if a<b then exit(a) else exit(b);
end;
begin
readln(n,m);
for i:=1 to n do
for j:=1 to m do read(a[i,j]);
for i:=1 to n do
for j:=1 to m do if a[i,j]=1 then
begin
f[i,j]:=min(min(f[i,j-1],f[i-1,j]),f[i-1,j-1])+1; if f[i,j]>x then
x:=f[i,j];
end;
writeln(x);
end.
4 条评论
-
hahayang LV 10 @ 2016-12-31 15:38:16
var
a, f:array[0..1000, 0..1000] of longint;
n, m, i, j, s:longint;
function max(x, y:longint):longint;
begin
if x>y then max:=x
else max:=y
end;
function min(x, y, z:longint):longint;
begin
if x<y then min:=x
else min:=y;
if z<min then min:=z
end;
begin
readln(n, m);
for i:=1 to n do
for j:=1 to m do read(a[i, j]);
s:=0;
fillchar(f, sizeof(f), 0);
for i:=1 to n do
for j:=1 to m do if a[i, j]=1 then begin
f[i, j]:=min(f[i-1, j], f[i, j-1], f[i-1, j-1])+1;
s:=max(s, f[i, j])
end;
write(s)
end. -
2016-12-14 14:38:31@
what
-
2015-07-16 17:02:05@
不太懂
-
2014-12-06 21:49:27@
请正确地发布源代码
- 1