#include<iostream>
using namespace std;
double l = -10000, r = 10000;
int main()
{
double x;
cin>>x;
while(r - l > 1e-8){
double mid = (l + r) / 2;
if(mid * mid * mid >= x){
r = mid;
}
else{
l = mid;
}
}
printf("%.6lf\n", l);
return 0;
}
AcWing 数的三次方根 题解 (浮点数的二分)
最新推荐文章于 2022-01-05 22:40:59 发布