当前位置:网站首页>Uva10341 solve it
Uva10341 solve it
2022-06-26 13:09:00 【YJEthan】
The question : seek f(x)=p*e^-x+q*sin(x)+r*cos(x)+s*tan(x)+t*x*x+u=0,0<=x<=1
Thinking is divided into two parts ;
#include<stdio.h>
#include<math.h>
typedef double dd;
int p,q,r,s,t,u;
dd solve(dd x)
{
return p*exp(-x)+q*sin(x)+r*cos(x)+s*tan(x)+t*x*x+u;
}
int main()
{
while(scanf("%d%d%d%d%d%d",&p,&q,&r,&s,&t,&u)!=EOF)
{
if(solve(0)<0||solve(1)>0)
{
printf("No solution\n");
continue;
}
dd mid=0.5,l=0.0,r=1.0;
while(fabs(solve(mid))>=0.00000001)// You can also write here while(r-l>=0.00000001)
{
if(solve(mid)>0)
l=mid;
else
r=mid;
mid=(l+r)/2.0;
}
printf("%.4lf\n",mid);
}
return 0;
}
边栏推荐
- UVA5009 Error Curves三分
- Use the script to crawl the beautiful sentences of the sentence fan website and store them locally (blessed are those who like to excerpt!)
- Word document export (using fixed template)
- P2393 yyy loves Maths II
- 四类线性相位 FIR滤波器设计 —— MATLAB源码全集
- Dark horse notes - Common APIs
- Common creation and usage of singletons
- Openlayers drawing dynamic migration lines and curves
- B - Bridging signals
- Electron official docs series: Contributing
猜你喜欢

自动化测试的局限性你知道吗?

opencv高速下载

Deep parsing MySQL binlog

Deeply analyze the differences between dangbei box B3, Tencent Aurora 5S and Xiaomi box 4S

Processing 多面体变化

倍福TwinCAT3实现CSV、TXT文件读写操作

倍福PLC通过MC_ReadParameter读取NC轴的配置参数

Unit practice experiment 8 - using cmstudio to design microprogram instructions based on basic model machine (1)

倍福TwinCAT3 NCI在NC轴界面中的基本配置和测试

National standard gb28181 protocol easygbs video platform TCP active mode streaming exception repair
随机推荐
D - skiing
find及du -sh显示权限不够的解决方法
详细讲解C语言11(C语言系列)
C - Common Subsequence
HDU 3709 Balanced Number
C structure: definition and example
To solve the difficulties of small and medium-sized enterprises, Baidu AI Cloud makes an example
体现技术深度(无法速成)
Electron official docs series: Distribution
Deeply analyze the differences between dangbei box B3, Tencent Aurora 5S and Xiaomi box 4S
mariadb学习笔记
National standard gb28181 protocol easygbs video platform TCP active mode streaming exception repair
Explain C language 11 in detail (C language series)
自动化测试的局限性你知道吗?
Biff TwinCAT can quickly detect the physical connection and EtherCAT network through emergency scan
[esp32-c3][rt-thread] run RT-Thread BSP minimum system based on esp32c3
Do you know the limitations of automated testing?
Go structure method
复制多个excel然后命名不同的名字
适配器模式(Adapter)