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. Github搜索技巧

    按仓库名称.说明或自述文件内容搜索 通过 in 限定符,您可以将搜索限制为仓库名称.仓库说明.自述文件内容或这些的任意组合. 如果省略此限定符,则只搜索仓库名称和说明. 限定符 示例 in:name ...

  2. UnsupportedClassVersionError : 不支持的类版本错误

    UnsupportedClassVersionError : 不支持的类版本错误 listenerStart配置类的应用程序侦听器时出错 listenerStart Error configuring ...

  3. js—二进制中1的个数

    题目描述 输入一个整数,输出该数二进制表示中1的个数.其中负数用补码表示. 做题思路 代码 function NumberOf1(n) { // write code here var cnt = 0 ...

  4. 1.3.5 详解项目中的资源——Android第一行代码(第二版)笔记

    所有以drawable开头的文件夹都是用来存放图片的. 所有以mipmap开头的文件夹都是用来存放应用图标的 所有以values开头的文件夹都是用来存放字符串.样式.颜色等配置的, layout文件夹 ...

  5. 展讯sprd_battery.c 充电驱动

    sprd_battery.c 是充电驱动,这个是充电功能的核心内容,电量显示策略.温度检测策略.充电保护机制等功能在这里实现,功能实现与硬件细节剥离,调用通用接口实现逻辑控制: 1 sprdbat_p ...

  6. kubernetes 资源管理

    前言 在kubernetes环境下,无论集群再大,对应的集群资源(cpu.memory.storage)总是有上限的.而默认情况下,我们启动的pod.以及pod中运行的容器,对应的资源是不加限制的.理 ...

  7. 安装NodeJs和NPM到Ubuntu(APT)

    运行环境 系统版本:Ubuntu 16.04.2 LTS 软件版本:node-v10.16.3.npm-6.9.0 硬件要求:无 安装过程 1.安装NPM和NodeJs root@localhost: ...

  8. VSCode 完美整合前后端框架(angular2+.NET core)

    首先打开命令行查看本地.NET版本. 通过命令行安装模板. dotnet new --install Microsoft.AspNetCore.SpaTemplates::* 创建demo目录,并用v ...

  9. udp socket 10054

    udp socket 10054 在接收端没有启动的情况下 1.直接ReceiveFrom没问题. 2.如果先SendTo再ReceiveFrom,SendTo可以正常过,但是RecieveFrom会 ...

  10. Docker Stack 学习笔记

    该文为<深入浅出Docker>的学习笔记,感谢查看,如有错误,欢迎指正 一.简介 Docker Stack 是为了解决大规模场景下的多服务部署和管理,提供了期望状态,滚动升级,简单易用,扩 ...