Solve the equation:

        p ∗ e −x + q ∗ sin(x) + r ∗ cos(x) + s ∗ tan(x) + t ∗ x 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

题意:给出一个方程,求解X;

思路:因为方程是单调递减的,所以二分求解;

 #include<iostream>
#include<cstdio>
#include<cmath>
#define EPS (10e-8)
using namespace std;
double p,q,r,s,t,u;
inline double fomula(double x){
return p*exp(-x)+q*sin(x)+r*cos(x)+s*tan(x)+t*x*x+u;
}
int main(){
while(scanf("%lf%lf%lf%lf%lf%lf",&p,&q,&r,&s,&t,&u)!=EOF){
double left=, right=, mid;
bool flag=false;
if(fomula(left)*fomula(right) > ){
printf("No solution\n");
continue;
}
while(right-left > EPS){
mid = (left+right)/;
if(fomula(mid)*fomula(left) > ) left=mid;
else right=mid;
} printf("%.4f\n", mid);
}
return ;
}

UVa - 12050 Palindrome Numbers (二分)的更多相关文章

  1. Uva - 12050 Palindrome Numbers【数论】

    题目链接:uva 12050 - Palindrome Numbers 题意:求第n个回文串 思路:首先可以知道的是长度为k的回文串个数有9*10^(k-1),那么依次计算,得出n是长度为多少的串,然 ...

  2. POJ2402/UVA 12050 Palindrome Numbers 数学思维

    A palindrome is a word, number, or phrase that reads the same forwards as backwards. For example,the ...

  3. UVa 12050 - Palindrome Numbers (回文数)

    A palindrome is a word, number, or phrase that reads the same forwards as backwards. For example, th ...

  4. UVA 12050 - Palindrome Numbers 模拟

    题目大意:给出i,输出第i个镜像数,不能有前导0. 题解:从外层开始模拟 #include <stdio.h> int p(int x) { int sum, i; ;i<=x;i+ ...

  5. UVa 10006 - Carmichael Numbers

    UVa 10006 - Carmichael Numbers An important topic nowadays in computer science is cryptography. Some ...

  6. Palindrome Numbers(LA2889)第n个回文数是?

     J - Palindrome Numbers Time Limit:3000MS     Memory Limit:0KB     64bit IO Format:%lld & %llu ...

  7. 2017ecjtu-summer training #1 UVA 12050

    A palindrome is a word, number, or phrase that reads the same forwards as backwards. For example, th ...

  8. UVa - 12050

    A palindrome is a word, number, or phrase that reads the same forwards as backwards. For example,the ...

  9. UVA.136 Ugly Numbers (优先队列)

    UVA.136 Ugly Numbers (优先队列) 题意分析 如果一个数字是2,3,5的倍数,那么他就叫做丑数,规定1也是丑数,现在求解第1500个丑数是多少. 既然某数字2,3,5倍均是丑数,且 ...

随机推荐

  1. 5G和AI会碰撞出什么样的火花呢?

    本文学习和分享一篇综述文章,这篇文章是东南大学移动通信国家重点实验室主任.长江学者特聘教授尤肖虎教授2019年发表在<中国科学 信息科学>(<SCIENCE CHINA Inform ...

  2. 题解【[USACO05NOV]奶牛玩杂技】

    \[ \texttt{Description} \] 有 \(n\) 头牛,每头牛都有自己的体重 \(W_i\) 和力量 \(S_i\) . 将这 \(n\) 头牛摞在一起,每头牛的压扁指数定义为:压 ...

  3. JavaScript九九乘法表

    JavaScript九九乘法表 <script> for (var i = 1; i < 10; i++) { for (var j = 1; j <= i; j++) { d ...

  4. Docker下Jenkins的安装部署、更新

    一.下载Jenkins镜像 docker pull jenkins/jenkins 二.创建挂载文件 mkdir /srv/jenkins chown -R : /srv/jenkins 三.启动Do ...

  5. ts中的泛型

    /** * 泛型:软件工程中,我们不仅要创造定义良好的API,同时也要考虑可重用行,组件不仅能 * 够支持当前的数据类型,同时也能够支持未来数据类型. * 通俗理解:泛型就是解决类.接口.方法的复用性 ...

  6. P3945 | 三体问题 (天体物理+计算几何)

    最近终于把<三体Ⅰ·地球往事>和<三体Ⅱ·黑暗森林>看完了! 为了快点认识题目中的歌者文明,已经开始第三部了! 题目背景 @FirstLight0521 出题人在这里哦~ 三体 ...

  7. lucas定理及其拓展的推导

    lucas定理及其拓展的推导 我的前一篇博客-- lucas定理 https://mp.csdn.net/mdeditor/100550317#主要是给出了lucas的结论和模板,不涉及推导. 本篇文 ...

  8. 自定义配置JNOJ

    OJ 全名 online judge 在线判题系统,对于从事编程竞赛的人来说一点都不陌生,今天我们讨论的是怎么样自定义搭建 推荐的开源的OJ有hustOJ,JNOJ 因为hustOJ 是一键安装脚本, ...

  9. SpringBoot从1.5.1→2.2.4项目加包扫雷二:打不到符号java: org.springframework.boot.autoconfigure.web.相关配置错误支持包

    import org.springframework.boot.autoconfigure.web.DefaultErrorAttributes→org.springframework.boot.we ...

  10. P2055 [ZJOI2009]假期的宿舍【二分图/最大流】

    题目描述 学校放假了 · · · · · · 有些同学回家了,而有些同学则有以前的好朋友来探访,那么住宿就是一个问题. 比如 A 和 B 都是学校的学生,A 要回家,而 C 来看B,C 与 A 不认识 ...