当前位置:网站首页>7-2 数的三次方根
7-2 数的三次方根
2022-06-26 12:32:00 【白—】
7-2 数的三次方根
知识点:二分
给定一个浮点数 n,求它的三次方根。
输入格式:
共一行,包含一个浮点数 n(−10000≤n≤10000)。
输出格式:
共一行,包含一个浮点数,表示问题的解。
注意,结果保留 6 位小数。
输入样例:
1000.00
输出样例:
10.000000
代码:
#include<stdio.h>
#include<math.h>
double n;
int main()
{
///n(−10000≤n≤10000)
double l=-10000;
double r=10000;
scanf("%lf",&n);
while(r-l>=1e-8)
{
double mid=(l+r)/2;
if(pow(mid,3)>n)
r=mid;
else
l=mid;
}
printf("%.6lf",l);
}
202206260912日
边栏推荐
- Comparison of latest mobile phone processors in 2020 (with mobile phone CPU ladder diagram)
- PHP generate order number
- "Pinduoduo and short video speed version", how can I roast!
- Using the methods in the repository to solve practical problems
- 7-3 最低通行费
- Laravel+gatewayworker completes the im instant messaging and file transfer functions (Chapter 4: server debugging errors)
- Ctrip ticket app KMM cross end kV repository mmkv kotlin | open source
- 汇编语言(7)运算指令
- Analysis report on the "fourteenth five year plan" and investment prospect of China's pharmaceutical equipment industry 2022-2028
- What should I do from member labels to portraits?
猜你喜欢
This executeQuery (SQL) cannot compile classes for JSP. What is the reason?
Deep thinking from senior member managers
leetcode 715. Range module (hard)
女性科学家的流失
Php+laravel5.7 use Alibaba oss+ Alibaba media to process and upload image / video files
Scala-day06- pattern matching - Generic
International beauty industry giants bet on China
Xiaolong 888 was released, Xiaomi 11 was launched, and 14 manufacturers carried it in the first batch!
11、 Box styles and user interface
Build Pikachu shooting range and introduction
随机推荐
Laravel+gatewayworker completes the im instant messaging and file transfer functions (Chapter 4: server debugging errors)
Laravel subdomain accesses different routing files and different modules
Fengshentai old shooting range Kali series
一个初级多线程服务器模型
Current situation investigation and investment prospect forecast analysis report of China's electrolytic copper market from 2022 to 2028
China Medical Grade hydrogel market supply and demand research and prospect analysis report 2022 Edition
Lintcode 130 · 堆化
fastjson的JSONArray和JSONObject[通俗易懂]
The best CMDB system
Deep thinking from senior member managers
HUST网络攻防实践|6_物联网设备固件安全实验|实验三 FreeRTOS-MPU 保护绕过
HUST網絡攻防實踐|6_物聯網設備固件安全實驗|實驗二 基於 MPU 的物聯網設備攻擊緩解技術
Research on the current situation of China's modified engineering plastics market and demand forecast analysis report 2022-2028
dried food! Yiwen will show you SD card, TF card and SIM card!
Jmeter响应时间和tps监听器使用教程
A most practical arbitrage wizard EA [2022 modified version]
Omnichannel membership - tmall membership 2: frequently asked questions
Ctrip ticket app KMM cross end kV repository mmkv kotlin | open source
What determines the rent
Is it safe to open a securities account in general