Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const fi='';
- fo='';
- var n,m,i,j,count:longint;
- a:array[0..100,0..100]of char;
- b:array[1..100,1..100]of boolean;
- begin
- assign(input,fi);reset(input);
- assign(output,fo);rewrite(output);
- readln(n,m);
- for i:=1 to n do
- begin
- for j:=1 to m do read(a[i,j]);
- readln;
- end;
- for i:=1 to n do a[i,0]:='.';
- for i:=1 to m do a[0,i]:='.';
- fillchar(b,sizeof(b),false);
- count:=0;
- for i:=1 to n do
- for j:=1 to m do
- if (a[i,j]='#') and (not b[i,j]) then
- begin
- inc(count);
- if a[i,j+1]='#' then
- begin
- b[i,j]:=true;
- b[i,j+1]:=true;
- end else
- if a[i+1,j]='#' then
- begin
- b[i,j]:=true;
- b[i+1,j]:=true;
- end;
- end;
- writeln(count);
- close(input);close(output);
- end.
Advertisement
Add Comment
Please, Sign In to add comment