Accepted
/usr/bin/ld.bfd: warning: /out/link.res contains output sections; did you forget -T?
代码
var n,m,i,j,cnt,ans:longint;
    u,a:array[0..50,0..50]of boolean;
    s:string;
begin
 readln(n,m);
 for i:=1 to n do begin
  readln(s);
  for j:=1 to m do
  if s[j]='Y' then a[i,j]:=true
  else a[i,j]:=false;
 end;
 ans:=0;
 fillchar(u,sizeof(u),false);
 for i:=1 to n do begin
  cnt:=0;
  for j:=1 to m do
  if (a[i,j]=true)and(u[i,j-1]<>true) then begin
   u[i,j]:=true; inc(cnt);
  end;
  inc(ans,cnt);
 end;
 writeln(ans);
 close(input);
 close(output);
end.