题解 | #求解立方根#
求解立方根
http://www.nowcoder.com/practice/caf35ae421194a1090c22fe223357dca
//你不让用就不让?
import java.util.*;
public class Main{
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
while(sc.hasNext()){
double num = sc.nextDouble();
double flag = 0;
if(num > 0){
flag = 1.0;
}else{
flag = -1.0;
}
System.out.println(flag * Double.parseDouble(String.format("%.1f", Math.exp((Math.log(Math.abs(num)) / 3)))));
}
}
}