Форум АНТИЧАТ

Форум АНТИЧАТ (https://forum.antichat.xyz/index.php)
-   С/С++, C#, Delphi, .NET, Asm (https://forum.antichat.xyz/forumdisplay.php?f=24)
-   -   из Java в Pascal (https://forum.antichat.xyz/showthread.php?t=106369)

Moldman 15.02.2009 19:25

из Java в Pascal
 
Нужно перевести программу из Java в Pascal

программа считает по высоте столбцы из 0 из бинарной матрицы
первая число высота второе количество

пример
Pentagon.In Pentagon.OUT
1110000111 1 7
1100001111 2 1
1000000011 3 2
1111101111 5 1
1110000111

Moldman 15.02.2009 20:47

Код:

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.

Подскажите,что неправильно


Время: 07:55