比赛 20101116 评测结果 AATTTTTTTA
题目名称 剪切矩形 最终得分 30
用户昵称 Achilles 运行时间 0.000 s
代码语言 Pascal 内存使用 0.00 MiB
提交时间 2010-11-16 10:29:37
显示代码纯文本
program rectangle;
var
  n,m,i,j,ans,i1,i2,i3,i4:longint;
  t:char;
  tab:array[0..1000,0..1000]of longint;
begin
  fillchar(tab,sizeof(tab),0);
  assign(input,'rectangle.in');
  assign(output,'rectangle.out');
  reset(input);
  rewrite(output);
  readln(n,m);
  for i:=1 to n do
  begin
    for j:=1 to m do
    begin
      read(t);
      if t='*' then tab[i,j]:=1 else tab[i,j]:=0;
      tab[i,j]:=tab[i,j]+tab[i-1,j]+tab[i,j-1]-tab[i-1,j-1];
    end;
    readln;
  end;
  ans:=0;
  for i1:=1 to n do
    for i2:=1 to m do
      for i3:=1 to n-i1+1 do
        for i4:=1 to m-i2+1 do
        begin
          if tab[i1+i3-1,i2+i4-1]-tab[i1-1,i2+i4-1]-tab[i1+i3-1,i2-1]+tab[i1-1,i2-1]=0 then begin
            ans:=ans+1;
          end;
        end;
  writeln(ans);
  close(input);
  close(output);
end.