Pagini recente » Cod sursa (job #2603877) | Cod sursa (job #768190) | Cod sursa (job #3233966) | Cod sursa (job #563277) | Cod sursa (job #273458)
Cod sursa(job #273458)
var n,m,i,j,max,c1,c0:integer;
a:array[1..100,1..100] of integer;
f,g:text;
begin
assign(f,'teren.in');
reset (f);
read (f,n);read (f,m);
for i:=1 to n do
begin
for j:=1 to m do
read (f,a[i,j]);
end;
close (f);
end;max:=0;c1:=0;c0:=0;
for i:=1 to n do
begin
for j:=1 to m do
begin
if a[i,j]=0 then
c0:=c0+1;
if a[i,j]=1 then
c1:=c1+1;
end;
if c1>1 then
begin
c1:=0;
c0:=0;
end;
if c0>max then
max:=c0+c1;
end;
for i:=1 to m do
begin
for j:=1 to n do
begin
if a[i,j]=0 then
c0:=c0+1;
if a[i,j]=1 then
c1:=c1+1;
end;
if c1>1 then
begin
c1:=0;
c0:=0;
end;
if c0>max then
max:=c0+c1;
end;
assign (g,'teren.out');
rewrite (g);
write (g,max);
close (g);
end.