当前位置:网站首页>7-2 the cubic root of a number
7-2 the cubic root of a number
2022-06-26 13:23:00 【White -】
7-2 The third root of a number
Knowledge point : Two points
Given a floating-point number n, Find its third root .
Input format :
All in one line , Contains a floating-point number n(−10000≤n≤10000).
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 .
sample input :
1000.00
sample output :
10.000000
Code :
#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 Japan
边栏推荐
猜你喜欢

Decorator

MySQL explanation (II)

Beifu twincat3 can read and write CSV and txt files

首批通过!百度智能云曦灵平台获信通院数字人能力评测权威认证

解中小企业之困,百度智能云打个样

Mode pont
Summary of wechat applet test points

Design of simple digital circuit traffic light

Beifu realizes the control of time slice size and quantity through CTU and ton

Beifu PLC based on NT_ Shutdown to realize automatic shutdown and restart of controller
随机推荐
IDC report: the AI cloud market share of Baidu AI Cloud ranks first for six consecutive times
Mysql database explanation (6)
防火墙介绍
【Spark】. Explanation of several icons of scala file in idea
Uva11582 [fast power]colossal Fibonacci numbers!
Aesthetic experience (episode 238) Luo Guozheng
Luogu p3426 [poi2005]sza-template solution
J - Wooden Sticks poj 1065
H5 video automatic playback and circular playback
MySQL数据库常见故障——遗忘数据库密码
Electron official docs series: Testing And Debugging
[how to connect the network] Chapter 2 (middle): sending a network packet
MySQL讲解(二)
ES中索引别名(alias)的到底有什么用
A primary multithreaded server model
Ring queue PHP
Typescript
[shell] generate strings between specified dates
解中小企业之困,百度智能云打个样
7-2 picking peanuts