题解 | #求解立方根#
求解立方根
https://www.nowcoder.com/practice/caf35ae421194a1090c22fe223357dca
a=float(input()) b=1 if a<0: b=-1 a=a*b for i in range(20): if i*i*i<=a and a<(i+1)*(i+1)*(i+1): break for n in range(1000): if (n*0.001+i)*(n*0.001+i)*(n*0.001+i)<=a and ((n+1)*0.001+i)*((n+1)*0.001+i)*((n+1)*0.001+i)>a: res=n*0.001+i #print(res) if b==1: print(round(res,1)) else: print(round(res*-1,1))