其他分享
首页 > 其他分享> > 790. 数的三次方根

790. 数的三次方根

作者:互联网

 

 

#include <cstdio>
#include <cmath>

int main()
{
    double x;
    scanf("%lf", &x);
    
    double l = -10000, r = 10000;
    while (r - l > 1e-8)
    {
        double mid = (l + r) / 2;
        if (mid * mid * mid > x)    r = mid;
        else    l = mid;
    }
    
    printf("%.6f\n", l);
    return 0;
}

 

标签:lf,10000,790,double,mid,方根,三次,include
来源: https://www.cnblogs.com/mjn1/p/15200722.html