#include<iostream>
#include<cmath>
using namespace std;
float f(float y, int n, float x)
{
float p=1;
for(int i=1;i<=n;i++) p=p*y;
return p-x;
}
float DEI(float s, float d, int n, float x)
{
if(d-s<=0.0001) return s;
else
{ float m=(s+d)/2;
if(f(m,n,x)==0) return m;
else if(f(m,n,x)<0) return DEI(m,d,n,x);
else return DEI(s,m,n,x);
}
}
int main()
{
int n;
float x;
cin>>n>>x;
cout<<DEI(0,sqrt(x),n,x);
return 0;
}
|