比赛 |
20101116 |
评测结果 |
AAAAATTTTA |
题目名称 |
剪切矩形 |
最终得分 |
60 |
用户昵称 |
ybh |
运行时间 |
0.000 s |
代码语言 |
Pascal |
内存使用 |
0.00 MiB |
提交时间 |
2010-11-16 11:36:34 |
显示代码纯文本
program rectangle;
var
a:array[0..1001,0..1001] of boolean;
s:array[0..1001,0..1001] of longint;
n,m,i,j,k,p,sum:longint;
ans:int64;
r:char;
begin
assign(input,'rectangle.in');
reset(input);
assign(output,'rectangle.out');
rewrite(output);
readln(n,m);
for i:=1 to n do
begin
sum:=0;
for j:=1 to m do
begin
read(r);
if r='.'
then a[i,j]:=true
else a[i,j]:=false;
if a[i,j]=false
then sum:=sum+1;
s[i,j]:=s[i-1,j]+sum;
end;
readln;
end;
for i:=1 to n do
for j:=i to n do
begin
p:=0;
k:=1;
while k<=m do
begin
while (s[j,k]-s[i-1,k]-s[j,k-1]+s[i-1,k-1]=0) and (k<=m) do
begin
p:=p+1;
k:=k+1;
end;
k:=k+1;
ans:=ans+p*(p+1) div 2;
p:=0;
end;
end;
writeln(ans);
close(input);
close(output)
end.