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;
}

最新文章

  1. angular2系列教程(十)两种启动方法、两个路由服务、引用类型和单例模式的妙用
  2. 用SignalR 2.0开发客服系统[系列2:实现聊天室]
  3. CSS中如何让元素隐藏
  4. delphi之多线程编程
  5. Spring基础知识汇总
  6. Jmeter之JDBC Request使用方法(oracle)
  7. This task is currently locked by a running workflow and cannot be edited
  8. 今年暑假不AC[HDU2037]
  9. WebService 的一些基本概念
  10. 检测php网站是否已经被攻破
  11. Vim简明教程【CoolShell】
  12. E - Speed Limit(2.1.1)
  13. libvirt里的面向对象的C语言
  14. Android应用系列:仿MIUI的Toast动画效果实现(有图有源码)
  15. 小学生四则运算出题软件-基于java控制台的实现
  16. 搭建ssm框架
  17. Mac 下如何下载、启动和关闭Tomcat 和管理Mac自带的Apache
  18. IIS 的几个小技巧
  19. call apply 使用
  20. Sublime Text 2之Emmet插件安装及使用

热门文章

  1. 移动电力猫HG260GT pon实现路由拨号
  2. Nowcoder186C 失衡天平 背包
  3. WPF C#仿ios 安卓 红点消息提示
  4. eclipse取消空格、等号、分号自动录入
  5. Linq 之 Select 和 where 的用法
  6. 【下一代核心技术DevOps】:(六)Rancher集中存储及相关应用
  7. SqlBulkCopy简单封装,让批量插入更方便
  8. Log4net_配置
  9. 开发CMDB系统
  10. C. Rectangles