题目链接:点击这里
#include<iostream>
#include<cstdio>
#include<algorithm>
using namespace std;
int main()
{
double n;
scanf("%lf", &n);
if(n < 0)
{
printf("-");
n = -n;
}
double l = 0, r = n;
while(r - l > 1e-8)
{
double mid = (l + r) / 2;
if(mid * mid * mid >= n) r = mid;
else l = mid;
}
printf("%.6f\n", l);
return 0;
}
来源:CSDN
作者:菜是原罪QAQ
链接:https://blog.csdn.net/qq_42815188/article/details/104636308