📄 ac1197.pas
字号:
program tju1197;
const
maxn=50;
var
e:array[0..maxn]of int64;
p:array[0..2,0..maxn]of int64;
n,m,i,j,a,b,c:word;
ch:char;
begin
e[0]:=1;for i:=1 to maxn do e[i]:=e[i-1]*2;
repeat
fillchar(p,sizeof(p),0);p[0,0]:=1;
read(n,m);
for i:=0 to n-1 do begin
a:=i mod 3;b:=(i+1) mod 3;c:=(i+2) mod 3;
fillchar(p[c],sizeof(p[c]),0);
for j:=0 to i do begin
repeat read(ch);until ch in ['*','.'];
case ch of
'*':begin inc(p[b,j],p[a,j]);inc(p[b,j+1],p[a,j]);end;
'.':inc(p[c,j+1],p[a,j]*4);
end;
end;
end;
if p[b,m]=0 then begin writeln('0/1');continue;end;
while not odd(p[b,m]) do begin
p[b,m]:=p[b,m] shr 1;dec(n);
end;
writeln(p[b,m],'/',e[n]);
until seekeof;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -