C++ 代码
注意区间
# include <iostream>
using namespace std;
const int N = 1e4;
int main()
{
double x;
cin >> x;
double l = -N, r = N;
while(r - l > 1e-8)
{
double mid = (l + r) / 2;
if (mid * mid * mid >= x) r = mid;
else l = mid;
}
printf("%lf", l);
return 0;
}