思想:
使用二分的方法判断
package cn.liyi.day03;
import java.util.Scanner;
public class Demo190 {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
double x = sc.nextInt();
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;
}
System.out.printf("%.6f\n",l);
// System.out.println(l);
}
}