Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var i,j,poc: byte;
- mapa: array[1..40,1..40] of char;
- vys: array[1..40,1..40] of byte;
- const a = 6; b = 33;
- procedure lesik(x,y:byte);
- Begin
- if mapa[x,y] = '^' then
- Begin
- vys[x,y] := poc;
- mapa[x,y] := '.';
- if x>=2 then lesik(x-1,y);
- if y>=2 then lesik(x,y-1);
- if x<=a-1 then lesik(x+1,y);
- if y<=b-1 then lesik(x,y+1);
- end;
- end;
- Begin
- assign(input,'mapa.in'); reset(input);
- poc := 1;
- for i:=1 to a do
- Begin
- for j:=1 to b do
- read(mapa[i,j]);
- readln;
- end;
- for i:=1 to a do
- Begin
- for j:=1 to b do
- write(mapa[i,j]);
- writeln;
- end;
- for i:=1 to a do
- for j:=1 to b do
- if mapa[i,j] = '^' then
- Begin
- lesik(i,j);
- poc := poc+1;
- end;
- for i:=1 to a do
- Begin
- for j:=1 to b do
- write(vys[i,j]);
- writeln;
- end;
- end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement