当前位置:网站首页>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;
}
边栏推荐
- Chopper webshell feature analysis
- 【web】理解 Cookie 和 Session 机制
- "NetEase Internship" Weekly Diary (2)
- 使用DBeaver进行mysql数据备份与恢复
- 项目后台技术Express
- oracle查询扫描全表和走索引
- Ask God to answer, how should this kind of sql be written?
- 【Unity入门计划】2D Game Kit:初步了解2D游戏组成
- From 2023 onwards, these regions will be able to obtain a certificate with a score lower than 45 in the soft examination.
- leetcode/字符串中的变位词-s1字符串的某个排列是s2的子串
猜你喜欢

2022-08-01 mysql/stoonedb slow SQL-Q18 analysis

BI - SQL 丨 WHILE

oracle query scan full table and walk index

Electronic Manufacturing Warehouse Barcode Management System Solution

工程师如何对待开源

局部敏感哈希:如何在常数时间内搜索Embedding最近邻

列表常用方法

Power button 1374. Generate each character string is an odd number

FOFAHUB使用测试

The Paddle Open Source Community Quarterly Report is here, everything you want to know is here
随机推荐
2022-08-01 mysql/stoonedb slow SQL-Q18 analysis
AWR分析报告问题求助:SQL如何可以从哪几个方面优化?
Remember a pit for gorm initialization
LeetCode刷题日记: 33、搜索旋转排序数组
[LeetCode Daily Question] - 103. Zigzag Level Order Traversal of Binary Tree
Nanoprobes丨1-mercapto-(triethylene glycol) methyl ether functionalized gold nanoparticles
oracle query scan full table and walk index
2022河南青训联赛第(三)场
Speed up your programs with bitwise operations
messy website
Safety (1)
个人博客系统项目测试
工程师如何对待开源
通用客户端架构
Handwriting a blogging platform ~ the first day
LeetCode刷题日记:153、寻找旋转排序数组中的最小值
Golang分布式应用之定时任务
LeetCode brushing diary: 53, the largest sub-array and
记一次gorm事务及调试解决mysql死锁
Simple example of libcurl accessing url saved as file