可能是小数操作咕咯
/*=========================
Source:
Problem:
Author:OYBDOOO
Date:
Result:
=========================*/
#include<bits/stdc++.h>
using namespace std;
const int maxn=3e5+5;
int n;
double f[maxn],k;
char s[maxn];
int main()
{
int i;
scanf("%d",&n);
for(i=1;i<=n;i++)
{
cin>>s[i];
if(s[i]=='x')
{
f[i]=f[i-1];
k=0;
}
else if(s[i]=='o')
{
f[i]=f[i-1]+2*k+1;
k+=1.0;
break;
}
else if(s[i]=='?')
{
f[i]=f[i-1]+k+0.5;
k=(k+1.0)/2.0;
}
}
printf("%.4lf",f[n]);
return 0;
}