Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
Register

## 问一个数据

Posted by lifeich1 at 2010-02-07 22:33:32 on Problem 1321
```4 2
#...
##..
...#
..#.

var
n,i,j,e,k1,k,ans:longint;
u:array[0..1023] of integer;
f,g:array[0..1023] of longint;
a:array[0..10,0..10] of char;
begin
while n>0 do begin
e:=(1 shl n);
fillchar(u,sizeof(u),false);
for i:=0 to e do  begin
j:=0;k:=i;
while k>0 do begin
if k and 1=1 then inc(j);
k:=k shr 1;
end;
if j=k1 then u[i]:=1;
end;
for i:=1 to n do begin
for j:=1 to n do read(a[i,j]);
end;
fillchar(g,sizeof(g),0);
fillchar(f,sizeof(f),0);
g[0]:=1;
ans:=0;
for i:=1 to n do begin
fillchar(f,sizeof(f),0);
for j:=1 to n do begin
if a[i,j]='.' then continue;
for k:=0 to e do begin
if k and (1 shl (j-1))>0 then continue;
inc(f[k+(1 shl (j-1))],g[k]);
end;
end;
for j:=0 to e do inc(g[j],f[j]);
end;
for j:=0 to e do if u[j]=1 then inc(ans,g[j]);
writeln(ans);
end;
end.
```

Followed by: