Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var i,j,n,m,c,h,t:integer;
- xet:string[200];
- a: array[1..200,1..200] of integer;
- function kt(var h,c:integer):integer;
- var i,cot,hang,dem,dt:integer;
- Begin
- dem:=0;
- dt:=0;
- for i:=1 to n do if a[i,c] = 2 then break else dem:=dem+1;
- if dem = n then dt:=dt+1;
- dem:=0;
- for i:=1 to m do if a[h,i] = 2 then break else dem:=dem+1;
- if dem = m then dt:=dt+1;
- if dt = 2 then
- Begin
- a[h,c]:=2;
- t:=t+1;
- end;
- end;
- Begin
- assign(input,'GRID.INP');
- reset(input);
- assign(output,'GRID.OUT');
- rewrite(output);
- read(n);
- readln(m);
- t:=0;
- for i:=1 to m do
- Begin
- readln(xet);
- for j:=1 to m do
- if xet[j] ='.' then a[i,j]:=0 else
- if xet[j] ='+' then a[i,j]:=1 else a[i,j]:=2;
- end;
- t:=0;
- for i:=1 to n do
- Begin
- h:=i;
- for j:=1 to m do
- Begin
- c:=j;
- if a[i,j] = 1 then kt(h,c) else
- if a[i,j] = 2 then break;
- end;
- end;
- writeln(t);
- for i:=1 to n do
- begin
- for j:=1 to m do
- case a[i,j] of
- 0 : write('.');
- 1 : write('+');
- 2 : write('*');
- end;
- writeln;
- end;
- end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement