当前位置:网站首页>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;
}
边栏推荐
- LeetCode 213. Robbery II (2022.08.01)
- Talking about the "horizontal, vertical and vertical" development trend of domestic ERP
- 2022 NPDP take an examination of how the results?How to query?
- GTK RGB图像绘制
- "NetEase Internship" Weekly Diary (2)
- AntPathMatcher uses
- NAS和私有云盘的区别?1篇文章说清楚
- volatile原理解析
- The Paddle Open Source Community Quarterly Report is here, everything you want to know is here
- 【LeetCode每日一题】——704.二分查找
猜你喜欢

BI - SQL 丨 WHILE
![[LeetCode Daily Question] - 103. Zigzag Level Order Traversal of Binary Tree](/img/b9/35813ae2972375fa728e3c11fab5d3.png)
[LeetCode Daily Question] - 103. Zigzag Level Order Traversal of Binary Tree

Garbage Collector CMS and G1

一次SQL优化,数据库查询速度提升 60 倍

Hash collisions and consistent hashing

The principle and code implementation of intelligent follower robot in the actual combat of innovative projects

字典常用方法

数据链路层的数据传输

永磁同步电机36问(三)——SVPWM代码实现

Chengdu openGauss user group recruit!
随机推荐
The principle and code implementation of intelligent follower robot in the actual combat of innovative projects
Nanoprobes纳米探针丨Nanogold偶联物的特点和应用
Analysis of the status quo of digital transformation of manufacturing enterprises
Hiring a WordPress Developer: 4 Practical Ways
From 2023 onwards, these regions will be able to obtain a certificate with a score lower than 45 in the soft examination.
Handwritten Blog Platform ~ Day Two
Chengdu openGauss user group recruit!
2022 NPDP take an examination of how the results?How to query?
Golang分布式应用之定时任务
BI-SQL丨WHILE
nacos启动报错,已配置数据库,单机启动
优炫数据库导库导错了能恢复吗?
How engineers treat open source
【 wheeled odometer 】
记一次gorm事务及调试解决mysql死锁
A good book for newcomers to the workplace
Scheduled tasks for distributed applications in Golang
BioVendor人俱乐部细胞蛋白(CC16)Elisa试剂盒研究领域
TKU remembers a single-point QPS optimization (I wish ITEYE is finally back)
Centos7 install postgresql and enable remote access