include [HTML_REMOVED]
int main()
{
double x = 0;
scanf(“%lf”, &x);
double r, l;
if (x >= 0)
{
l = 0;
r = x + 1;
while (r - l > 1e-9)
{
double mid = (l + r) / 2.0;
if (mid * mid * mid >= x)
r = mid;
else
l = mid;
}
}
else
{
r = 0;
l = x - 1;
while (r-l > 1e-9)
{
double mid = (l + r) / 2.0;
if (mid * mid * mid < x)
l = mid;
else
r = mid;
}
}
printf("%lf", l);
return 0;
}
//C语言,带有负数的判定