VBGRASS - Bãi cỏ ngon nhất
Tác giả: RR
Ngôn ngữ: Pascal
var
a:array[1..111,1..111] of char;
cnt,n,m,i,j:longint;
begin
readln(m,n); cnt:=0;
for i:=1 to m do
begin
for j:=1 to n do
read(a[i,j]);
readln;
end;
for i:=1 to m do
for j:=1 to n do
if a[i,j]='#' then
begin
inc(cnt);
if a[i,j+1]='#' then a[i,j+1]:='.';
if a[i+1,j]='#' then a[i+1,j]:='.';
end;
writeln(cnt);
end.