当前位置:网站首页>acwing 790. The cubic root of a number (floating-point number in half)
acwing 790. The cubic root of a number (floating-point number in half)
2022-06-12 16:18:00 【_ Liuxiaoyu】
Given a floating-point number n, Find its third root .
Input format
All in one line , Contains a floating-point number n.
Output format
All in one line , Contains a floating-point number , Represents the solution of the problem .
Be careful , The result is reserved 6 Decimal place .
Data range
−10000≤n≤10000
sample input :
1000.00
sample output :
10.000000
Ideas : Just two points
Remember to use the variable double type
Picture understanding :
#include <iostream>
using namespace std;
int main()
{
double x;
cin >> x;
double l = -10000, r = 10000; // Take the range of the result directly
while(r - l > 1e-8) // Empirical value : If you keep a few decimal places , Once again, add 2 The negative power of
{
double mid = (l + r) / 2; // There can no longer be int Variable
if( mid * mid * mid >= x) r = mid;
else l = mid;
}
printf("%lf\n", r); // Write here l perhaps r Will do
return 0;
}
边栏推荐
- Analysis on the current situation of China's antiarrhythmic drug industry in 2021: domestic R & D is further [figure]
- 小程序:如何在插件中获取用户手机号
- The C Programming Language(第 2 版) 笔记 / 7 输入与输出 / 7.8 其它函数
- 思考游戏王决斗链接中抽卡概率问题
- [tool recommendation] personal local markdown knowledge map software
- 记一篇IT培训日记067-好人感恩,坏人无错
- acwing 803. Interval merging
- Saga architecture pattern: implementation of cross service transactions under microservice architecture
- Keep an IT training diary 067- good people are grateful, bad people are right
- Project training of Software College of Shandong University rendering engine system radiation pre calculation (VIII)
猜你喜欢

Project training of Software College of Shandong University rendering engine system radiation pre calculation (VIII)

< 山东大学软件学院项目实训 > 渲染引擎系统——基础渲染器(四)

MYSQL---服务器配置相关问题
![Development status of China's pig breeding industry in 2021 and comparative analysis of key enterprises: 671million pigs were sold [figure]](/img/fd/5462c8c6deafeb7d7728716eb4db74.jpg)
Development status of China's pig breeding industry in 2021 and comparative analysis of key enterprises: 671million pigs were sold [figure]

Multimix:从医学图像中进行的少量监督,可解释的多任务学习

The C Programming Language(第 2 版) 笔记 / 8 UNIX 系统接口 / 8.7 实例(存储分配程序)

< 山东大学软件学院项目实训 > 渲染引擎系统——辐射预计算(八)

Acwing 797 differential

Unicom Network Management Protocol block diagram

Project training of Software College of Shandong University rendering engine system point cloud processing (10)
随机推荐
Project training of Software College of Shandong University rendering engine system radiation pre calculation (VIII)
批量--03---CmdUtil
Global and Chinese market for commercial ceiling fans 2022-2028: Research Report on technology, participants, trends, market size and share
写代码也有本手俗手之分,而我们要善于发现妙手!
< 山东大学软件学院项目实训 > 渲染引擎系统——基础渲染器(四)
Thinking about the probability of drawing cards in the duel link of game king
Office VR porn, coquettish operation! The father of Microsoft hololens resigns!
Acwing795 prefix sum (one dimension)
Object.keys遍历一个对象
华为设备配置CE双归属
超详细干货!Docker+PXC+Haproxy搭建高可用强一致性的MySQL集群
读取mhd、raw图像并切片、归一化、保存
批量--04---移动构件
Writing code can also be classified as "manual" or "vulgar", and we should be good at finding good hands!
Global and Chinese market of vascular prostheses 2022-2028: Research Report on technology, participants, trends, market size and share
5-5 configuring MySQL replication log point based replication
Thread pool execution process
Keep an IT training diary 067- good people are grateful, bad people are right
puppeteer入门之 Page 类
acwing 798二维差分(差分矩阵)