当前位置:网站首页>790. 数的三次方根
790. 数的三次方根
2022-08-02 02:20:00 【Hunter_Kevin】
题目
给定一个浮点数 n,求它的三次方根。
输入格式
共一行,包含一个浮点数 n。
输出格式
共一行,包含一个浮点数,表示问题的解。
注意,结果保留 6 位小数。
数据范围
−10000≤n≤10000
输入样例:
1000.00
输出样例:
10.000000
代码
#include <iostream>
using namespace std;
int main()
{
double n;
cin >> n;
double l = -1e5, r = 1e5;
while(r-l > 1e-8){
double mid = (l+r)/2;
if(mid*mid*mid >= n) r = mid;
else l = mid;
}
printf("%.6lf\n",l);
return 0;
}
边栏推荐
- ALCCIKERS Shane 20191114
- From 2023 onwards, these regions will be able to obtain a certificate with a score lower than 45 in the soft examination.
- [ORB_SLAM2] void Frame::ComputeImageBounds(const cv::Mat & imLeft)
- Use baidu EasyDL implement factory workers smoking behavior recognition
- 【web】理解 Cookie 和 Session 机制
- Pinduoduo leverages the consumer expo to promote the upgrading of domestic agricultural products brands and keep pace with international high-quality agricultural products
- AWR analysis report questions for help: How can SQL be optimized from what aspects?
- Reflex WMS Intermediate Series 7: What should I do if I want to cancel the picking of an HD that has finished picking but has not yet been loaded?
- LeetCode brushing diary: 53, the largest sub-array and
- Safety (2)
猜你喜欢
[LeetCode Daily Question] - 103. Zigzag Level Order Traversal of Binary Tree
LeetCode Brushing Diary: 74. Searching 2D Matrix
【 wheeled odometer 】
Chopper webshell feature analysis
[LeetCode Daily Question]——654. The largest binary tree
永磁同步电机36问(三)——SVPWM代码实现
AWR analysis report questions for help: How can SQL be optimized from what aspects?
Hash collisions and consistent hashing
FOFAHUB使用测试
Nanoprobes多组氨酸 (His-) 标签标记:重组蛋白检测方案
随机推荐
Service discovery of kubernetes
Pinduoduo leverages the consumer expo to promote the upgrading of domestic agricultural products brands and keep pace with international high-quality agricultural products
NAS和私有云盘的区别?1篇文章说清楚
Hash collisions and consistent hashing
LeetCode刷题日记:74. 搜索二维矩阵
垃圾回收器CMS和G1
Unable to log in to the Westward Journey
Power button 1374. Generate each character string is an odd number
AI目标分割能力,无需绿幕即可实现快速视频抠图
oracle查询扫描全表和走索引
Chengdu openGauss user group recruit!
bool框架::PosInGrid (const简历:关键点kp, int &posX, int诗句)
拼多多借力消博会推动国内农产品品牌升级 看齐国际精品农货
Reflex WMS Intermediate Series 7: What should I do if I want to cancel the picking of an HD that has finished picking but has not yet been loaded?
nacos启动报错,已配置数据库,单机启动
数据链路层的数据传输
AWR分析报告问题求助:SQL如何可以从哪几个方面优化?
Redis Subscription and Redis Stream
Centos7 安装postgresql并开启远程访问
2022-07-30 mysql8 executes slow SQL-Q17 analysis