
15.02.2009, 20:47
|
|
Участник форума
Регистрация: 12.06.2007
Сообщений: 153
Провел на форуме: 1990548
Репутация:
58
|
|
Код:
Program Pentagon;
const nmax=200;
mmax=255;
var i,j,n,m,k:integer;
B:array[0..nmax,0..mmax] of -1..255;
C:array[0..mmax] of integer;
Intrare:text;
Iesire:text;
begin
readln(n,m);
for i:=1 to n do
begin
for j:=1 to m do read(B[i,j]);
readln;
end;
assign(Intrare, 'Pentagon.IN');
rewrite(Intrare);
write(Intrare, n,' ', m);
writeln;
for i:=1 to n do
begin
for j:=1 to m do write(Intrare, B[i, j]);
writeln(Intrare);
end;
close(Intrare);
for J:=1 to n do
begin
i:=0;
while i<=m do
begin
while (i<=m) and (B[i,j]=1) do
begin
Inc(i);
end;
k:=0;
while (i<=m) and (B[i,j]=0)do
begin
Inc(k); Inc(i);
end;
Inc(C[k]);
end;
end;
assign(Iesire, 'pentagon.OUT');
rewrite(Iesire);
for i:=1 to m do
if C[i]>0 then writeln(Iesire,i,' ',C[i]);
close(Iesire);
end.
Подскажите,что неправильно
|
|
|