题意一直没看懂~~~~不过看懂了之后还是感觉挺好的
#include<cstdio>
#include<cstring>
#include<algorithm>
#define maxn 32
using namespace std;
int n;
double p[maxn],t; void pre()
{
p[]=;
for(int i=;i<=;i++)
p[i]=p[i-]*2.0;
} double solve()
{
double f=p[n];
for(int i=n-;i>=;i--)
{
double eq=p[i]/f;
if(eq<t)
f=(+t)*f/2.0;
else
f=(eq-t)*p[i]/(-t)+(-eq)*(eq+)*f/(-t)/2.0;
}
return f;
} int main()
{
pre();
while(scanf("%d%lf",&n,&t)&&n)
{
printf("%.3lf\n",solve());
}
return ;
}