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. c++ bool

    bool 就两个值,真或者假,通常用来存储关系表达式或者逻辑表达式的结果. 以前是用 int 来表示真假,大 int 有多个值,所以才规定 0 为假,非零为真,导致对应关系比较麻烦,有了 bool 就 ...

  2. vmware进程,虚拟机NAT模式配置固定ip,访问外网与ping通主机

    vmware进程杀不掉 在使用vmware虚拟机时,如果强制结束vmware进程,可能会发现在资源监视器中有一个vmware-vmx.exe进程始终关不掉,获得管理员权限去杀或者重启都没有用,然后正常 ...

  3. C语言 getchar

    C语言 getchar getchar是从标准输入设备读取一个char. 案例 #define _CRT_SECURE_NO_WARNINGS #include <stdio.h> #in ...

  4. 【算法】——递归:小白正在上楼梯,楼梯有n阶台阶,小白一次可以上1阶,2阶或者3阶,实现一个方法,计算小白有多少种走完楼梯的方式。

    分析:从最后一步分析,能有的情况有三种情况构成,写出如图所示的方程 //和斐波拉契相似 int void f(int n) { //考虑出口 ) ;//正常思路是返回0 ) ;//通过自己想可以得出只 ...

  5. 基于topsis和熵权法

    % % X 数据矩阵 % % n 数据矩阵行数即评价对象数目 % % m 数据矩阵列数即经济指标数目 % % B 乘以熵权的数据矩阵 % % Dist_max D+ 与最大值的距离向量 % % Dis ...

  6. 吴裕雄--天生自然HADOOP操作实验学习笔记:分布式资源调度系统yarn的安装

    实验目的 复习配置hadoop初始化环境 复习配置hdfs的配置文件 学会配置hadoop的配置文件 了解yarn的原理 实验原理 1.yarn是什么 前面安装好了hdfs文件系统,我们可以根据需求进 ...

  7. IDEA如何恢复到以前的代码

    虽然说IDEA的Ctrl+z撤销操作和Ctrl+Shift+Z重做操作为书写代码提供了很大的便利 但是在各种原因不小心失误撤销后又想不起来代码是怎么写的时候就非常尴尬,这时候就需要代码恢复到以前的状态 ...

  8. win10 mysql数据库中文乱码

    https://blog.csdn.net/weixin_41855029/article/details/80462234

  9. windows系统安装部署python3.5和python2.7双解释器并存

    前提材料准备: 下载对应版本的安装包:下载地址:https://www.python.org/downloads/windows/ python3.8.x安装包下载: python2.7.x安装包下载 ...

  10. nginx解决服务器宕机、解决跨域问题、配置防盗链、防止DDOS流量攻击

    解决服务器宕机 配置nginx.cfg配置文件,在映射拦截地址中加入代理地址响应方案 location / { proxy_connect_timeout 1; proxy_send_timeout ...