传送门
http://www.lydsy.com/JudgeOnline/problem.php?id=3450
题目大意
题解
const
maxn=1000005;
var
f,l:array[0..maxn]of real;
i,j,k:longint;
n:longint;
cha:char;
a:real;
begin
readln(n);
for i:=1 to n do
begin
read(cha);
case cha of
'o':a:=1;
'x':a:=0;
'?':a:=0.5;
end;
l[i]:=(l[i-1]+1)*a;
f[i]:=f[i-1]+(2*l[i-1]+1)*a;
end;
writeln(f[n]:0:4);
end.