当前位置:网站首页>790. The cube root of a number
790. The cube root of a number
2022-08-05 12:01:00 【aJupyter】
Question
Given a floating-point number n, find its cubic root.
Input format
One line contains a floating-point number n.
Output format
One line, including a floating point number, represents the solution of the problem.
Note that the result is rounded to 6 decimal places.
Data Range
−10000≤n≤10000
Input Sample:
1000.00
Output Sample:
10.000000
Ideas
Real bisection
Code
n = float(input())l,r = -100,100while (r-l) > 1e-8: # Keep x decimal places and write 1e-(x+2) here# Do not use bitwise operations to divide real numbers: bitwise operations are integer divisionsmid = (l + r) / 2if mid**3 >= n:r = midelse:l = midprint('{:.6f}'. format(l))边栏推荐
- I've only known since Kiali that configuring Istio's traffic management is so easy
- A woman is the most beautiful life in the world
- 分布式事务解决方案
- Huawei Analysis & Intermodal Activities to Help You Improve Overall Game Payments
- The principle and application scenario of mysql master-slave synchronization
- 简单钟表动画
- 学习用于视觉跟踪的深度紧凑图像表示
- Zhihu asks: Can China still achieve great national rejuvenation?
- The memory problem is difficult to locate, that's because you don't use ASAN
- 软件设计七大原则之开闭原则(Open-Closed Principle, OCP)
猜你喜欢

STM32H743IIT6学习笔记02——USART

isn't it?Is there anyone who can't locate the slow query problem of MySQL online?

高泽龙出席博鳌全球旅游生态大会 讲元宇宙与未来网络科技

正则表达式实战

C language example - print calendar

CC2530实现按键中断

CC2530 realizes key interrupt

该不该将单体架构迁移到微服务?

碘乙酰胺在Desthiobiotin-Iodoacetamide试剂中的作用?

【HMS core】【FAQ】Health Kit, Ads kit, Push Kit Typical Questions Collection 5
随机推荐
Byte Qiu Zhao confused me on both sides, and asked me under what circumstances would the SYN message be discarded?
C语言例题-计算常量e的值
关注微信公众号,自动登陆网站
Opening today: LiveVideoStackCon 2022 Audio and Video Technology Conference Shanghai Station
stm32项目之SPI通信2.4G模块(NF2401L)
2022.08.02_Daily question
KVM virtualization technology-NUMA technology and application
2022.08.01 _ a day
Gao Zelong attended the Boao Global Tourism Ecology Conference to talk about Metaverse and Future Network Technology
IPMP、PMP、CPMP三个证书该如何选择,有什么区别,哪个对于工作上的
sentinel介绍和使用
学习用于视觉跟踪的深度紧凑图像表示
STM32H743IIT6学习笔记02——USART
One: OpenCV image reading and writing file help documentation
MySQL之InnoDB存储结构
不是吧?还有人不会定位线上MySQL慢查询问题?
Face the summary - club resort - 6 years
码率vs.分辨率,哪一个更重要?
ansible-playbook配置ssh互信
分布式事务解决方案