2024-01-07 12:43:53 | 我爱编程网
手算:因为25³=15625>14783>24³=13824
所以14783的立方根在24到25之间
机算:如图
使用python
输入14783**(1/3)
得到
24.54261637383651(箭头1)
经验算,成立,误差可接受(箭头2)
>>> import math
>>> math.pow(27,1.0/3)
3.0
注意:这种方法求立方根是不准确的。
>>> math.pow(64,1.0/3)
>>> math.pow(64,1.0/3)
3.9999999999999996
上面是求立方根的方法。
输入10个数,求立方根:我爱编程网
>>> test = raw_input()
1 2 3 4 5 6 7 8 9 10
>>> for i in test.split():
math.pow(int(i),1.0/3)
1.0
1.2599210498948732
1.4422495703074083
1.5874010519681994
1.7099759466766968
1.8171205928321397
1.912931182772389
2.0
2.080083823051904
2.154434690031884
#include
#include
int main()
{int n;
scanf("%d",&n);
if(n%2)printf("%.10lf\n",sqrt(n));
else printf("%.10lf\n",pow(n,1.0/3));
return 0;
}
2024-01-01 09:58:48
2023-12-23 12:08:32
2023-09-13 13:02:53
2024-01-02 14:08:02
2024-01-01 07:26:50
2024-01-01 06:15:29