
Державин
7 год назад
Решите, пожалуйста задачу в Кумире, на ВЕТВЛЕНИЯ.
Срочно нужно!
Даю 95 баллов.

ОТВЕТЫ

Kalistratovich
Jul 17, 2019
Нач
нц
пока справа свободно вправо
кц
нц
пока снизу свободно вниз
кц
нц
пока слева не свободно вверх
кц
нц
пока слева свободно влево
кц
кон
нц
пока справа свободно вправо
кц
нц
пока снизу свободно вниз
кц
нц
пока слева не свободно вверх
кц
нц
пока слева свободно влево
кц
кон
Var
N:integer=600;
LABIRINT:array[0..600,0..600] of integer;
...
procedure setBlankAsDeadblockRec(x,y:integer);
var k:integer;
begin
k:=0;
if LABIRINT[x,y]=blank then
begin
if LABIRINT[x-1,y]lt;gt;BLANK then k:=k+1;
if LABIRINT[x,y-1]lt;gt;BLANK then k:=k+1;
if LABIRINT[x+1,y]lt;gt;BLANK then k:=k+1;
if LABIRINT[x,y+1]lt;gt;BLANK then k:=k+1;
if k=4 then LABIRINT[x,y]:=DEADBLOCK;
if k=3 then
begin
LABIRINT[x,y]:=DEADBLOCK;
if LABIRINT[x-1,y]=BLANK then setBlankAsDeadblockRec(x-1,y);
if LABIRINT[x,y-1]=BLANK then setBlankAsDeadblockRec(x,y-1);
if LABIRINT[x+1,y]=BLANK then setBlankAsDeadblockRec(x+1,y);
if LABIRINT[x,y+1]=BLANK then setBlankAsDeadblockRec(x,y+1);
end;
end;
end;
procedure setDeadblock;
var i,j:integer;
begin
for i:=1 to N-1 do
for j:=1 to N-1 do
setBlankAsDeadblockRec(i,j);
end;
147
Смежные вопросы: