UVa - 10341
Solve the equation:
p ∗ e ^−x + q ∗ sin(x) + r ∗ cos(x) + s ∗ tan(x) + t ∗ x ^2 + u = 0
2 + u = 0
where 0 ≤ x ≤ 1.
Input
Input consists of multiple test cases and terminated by an EOF. Each test case consists of 6 integers in
a single line: p, q, r, s, t and u (where 0 ≤ p, r ≤ 20 and −20 ≤ q, s, t ≤ 0). There will be maximum
2100 lines in the input file.
Output
For each set of input, there should be a line containing the value of x, correct up to 4 decimal places,
or the string ‘No solution’, whichever is applicable.
Sample Input
0 0 0 0 -2 1
1 0 0 0 -1 2
1 -1 1 -1 -1 1
Sample Output
0.7071
No solution
0.7554
解题思路:
直接二分从0.0000搜到1.0000,搜到就输入没搜到就返回-1;注意这个函数是递减的
二分代码:
double solve()
{
double low=,high=,mid;
if(fuck(low)*fuck(high)>)
return -;
while(high-low>1e-)
{
mid = low+(high-low)/;
if(fuck(mid)<)
high=mid;
else
low=mid;
}
return low;
}
UVa - 10341的更多相关文章
- UVA 10341 Solve It 解方程 二分查找+精度
		
题意:给出一个式子以及里面的常量,求出范围为[0,1]的解,精度要求为小数点后4为. 二分暴力查找即可. e^(-n)可以用math.h里面的exp(-n)表示. 代码:(uva该题我老是出现Subm ...
 - UVa 10341 - Solve It【经典二分,单调性求解】
		
原题: Solve the equation: p*e-x + q*sin(x) + r*cos(x) + s*tan(x) + t*x2 + u = 0 where ...
 - UVA 10341 Solve It 二分
		
题目大意:给6个系数,问是否存在X使得等式成立 思路:二分.... #include <stdio.h> #include <math.h> #define EEE 2.718 ...
 - UVA 10341  二分搜索
		
Solve the equation:p ∗ e−x + q ∗ sin(x) + r ∗ cos(x) + s ∗ tan(x) + t ∗ x2 + u = 0where 0 ≤ x ≤ 1.In ...
 - UVa 10341 (二分求根) Solve It
		
很水的一道题,因为你发现这个函数是单调递减的,所以二分法求出函数的根即可. #include <cstdio> #include <cmath> //using namespa ...
 - 【数值方法,水题】UVa 10341 - Solve It
		
题目链接 题意: 解方程:p ∗ e^(−x) + q ∗ sin(x) + r ∗ cos(x) + s ∗ tan(x) + t ∗ x^2 + u = 0 (0 <= x <= 1) ...
 - UVa 10341 - Solve It
		
题目:给一个方程,求解方程的解.已给出解的范围,并且可知方程等号左侧的函数是递减的,可用二分法进行试探,直到得出给定误差范围内的解. #include <cstdio> #include ...
 - UVA 10341.Solve It-二分查找
		
二分查找 二分查找又称折半查找,优点是比较次数少,查找速度快,平均性能好:其缺点是要求待查表为有序表,且插入删除困难.因此,折半查找方法适用于不经常变动而查找频繁的有序列表.首先,假设表中元素是按升序 ...
 - uva 1354 Mobile Computing ——yhx
		
aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAABGcAAANuCAYAAAC7f2QuAAAgAElEQVR4nOy9XUhjWbo3vu72RRgkF5
 
随机推荐
- 在IIS上部署你的ASP.NET Core项目 (转载)
			
概述 与ASP.NET时代不同,ASP.NET Core不再是由IIS工作进程(w3wp.exe)托管,而是使用自托管Web服务器(Kestrel)运行,IIS则是作为反向代理的角色转发请求到Kest ...
 - Luogu3320 SDOI2015 寻宝游戏 链并
			
传送门 可以发现从哪里开始的最优答案都是一样的.我们只需要用一种比较好维护的方法维护答案就好了. 我们考虑用$dfs$序加上$set$维护链并.先预处理$dfs$序,将当前有宝藏的点丢入$set$中, ...
 - 重写Override ToString()方法
			
使用一个小例子来演示: 创建一个普通类别: class Ax { private int _ID; public int ID { get { return _ID; } set { _ID = va ...
 - Luogu P2657 [SCOI2009]windy数
			
一道比较基础的数位DP,还是挺套路的. 首先看题,发现这个性质和数的大小无关,因此我们可以直接数位DP,经典起手式: \(f[a,b]=f(b)-f(a-1)\) 然后考虑如何求解\(f(x)\).我 ...
 - LeetCode之Add Two Numbers
			
Add Two Numbers 方法一: 考虑到有进位的问题,首先想到的思路是: 先分位求总和得到 totalsum,然后再将totalsum按位拆分转成链表: ListNode* addTwoNum ...
 - Crackme006 - 全新160个CrackMe学习系列(图文|视频|注册机源码)
			
知乎:逆向驿站 原文链接 CrackMe006 | 难度适中适合练手 |160个CrackMe深度解析(图文+视频+注册机源码) crackme006,依然是delphi的,而且没壳子,条线比较清晰, ...
 - Linux服务器性能压力测试
			
对于新采购的服务器,需要进行有必要的性能测试.这里选择UnixBench工具进行性能测试.记录如下: 1)安装使用下面的脚本使用了最新版UnixBench5.1.3来测试,注释了关于graphic的测 ...
 - [ERROR] Failed to execute goal org.codehaus.mojo:gwt-maven-plugin:2.5.0-rc1:compile (default) on project zeus-web: Command 解决
			
在编译maven项目,打包maven packeage -Dmaven.test.skip=TRUE时,报错“[ERROR] Failed to execute goal org.codehaus.m ...
 - Daily Scrum- 12/28
			
Meeting Minutes 讨论alpha 的feed back; 决定添加按钮向下的动作,作为feature; 完成了界面的微调,开始使用alpha.1进行feed back的收集 Burndo ...
 - Oracle12c Clone PDB 的方法
			
1. 创建PDB的存放路径,举例: 2. 设置 数据库创建数据文件的目录 alter system set db_Create_file_dest='C:\app\Administrator\orad ...