hdu 2199 Can you solve this equation?(二分法求多项式解)
题意
给Y值,找到多项式 8*x^4 + 7*x^3 + 2*x^2 + 3*x + 6 == Y 在0到100之间的解。
思路
从0到100,多项式是单调的,故用二分法求解。
代码
double calc(double x){
return 8*x*x*x*x+7*x*x*x+2*x*x+3*x+6;
}
int main(){
int T;
cin>>T;
while(T--){
double Y;
cin>>Y;
double L,R;
L = 0.0, R= 100.0;
if(calc(L)>Y || Y>calc(R)){
cout<<"No solution!"<<endl;
}else{
double mid;
while((R-L)>(1e-10)){
mid = (L+R) / 2;
if(calc(mid)>Y){
R = mid;
}else{
L = mid;
}
}
mid = (R+L)/2;
printf("%.4lf\n",mid);
}
}
return 0;
}
hdu 2199 Can you solve this equation?(二分法求多项式解)的更多相关文章
- hdu 2199 Can you solve this equation? (二分法)
Can you solve this equation? Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K ( ...
- HDU 2199 Can you solve this equation?(二分精度)
HDU 2199 Can you solve this equation? Now,given the equation 8*x^4 + 7*x^3 + 2*x^2 + 3*x + 6 == ...
- hdu 2199 Can you solve this equation?(高精度二分)
http://acm.hdu.edu.cn/howproblem.php?pid=2199 Can you solve this equation? Time Limit: 2000/1000 MS ...
- HDU 2199 Can you solve this equation?(二分解方程)
传送门: http://acm.hdu.edu.cn/showproblem.php?pid=2199 Can you solve this equation? Time Limit: 2000/10 ...
- hdu 2199:Can you solve this equation?(二分搜索)
Can you solve this equation? Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K ( ...
- ACM:HDU 2199 Can you solve this equation? 解题报告 -二分、三分
Can you solve this equation? Time Limit: / MS (Java/Others) Memory Limit: / K (Java/Others) Total Su ...
- hdu 2199 Can you solve this equation?(二分搜索)
Can you solve this equation? Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K ( ...
- HDU 2199 Can you solve this equation? (二分 水题)
Can you solve this equation? Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K ( ...
- HDU 2199 Can you solve this equation(二分答案)
Can you solve this equation? Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K ( ...
- HDU - 2199 Can you solve this equation? 二分 简单题
Can you solve this equation? Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K ( ...
随机推荐
- windows10 升级并安装配置 jmeter5.3
一.安装配置JDK Jmeter5.3依赖JDK1.8+版本,JDK安装百度搜索JAVA下载JDK,地址:https://www.oracle.com/technetwork/java/javase/ ...
- 配置阿里云gradle
build.gradle buildscript { ext { springBootVersion = '1.5.15.BUILD-SNAPSHOT' } repositories { // mav ...
- Jmeter集合点技术
集合点简介 好比小学时候做广播体操,先让大家集合,等到时间统一开始做体操. 创建集合点 同步定时器 同时签到 注意:作用域 参数设置 用户数 为0 具体数值,不能大于 超时时间 为0,没有超时时间 具 ...
- 对帧率、I/P率、I帧间隔的理解
码率就是数据传输时单位时间传送的数据位数,一般我们用的单位是kbps即千位每秒.通俗一点的理解就是取样率,单位时间内取样率越大,精度就越高,处理出来的文件就越接近原始文件,但是文件体积与取样率是成正比 ...
- P1758-[NOI2009]管道取珠【dp】
正题 题目链接:https://www.luogu.com.cn/problem/P1758 题目大意 给出一个大小为\(n\)和一个大小为\(m\)的栈,每次选择一个栈弹出栈顶然后记录这个字母,求所 ...
- P3335-[ZJOI2013]蚂蚁寻路【dp】
正题 题目链接:https://www.luogu.com.cn/problem/P3335 题目大意 给出\(n\times m\)的网格,每个格子有权值.一个回路在格子的边上,要求有\(2\tim ...
- WPF进阶技巧和实战03-控件(2-特殊容器)
ScrollViewer控件 直接继承ContextControl类,提供了虚拟界面,允许用户围绕更大的元素滚动.只能包含单个元素(ContextControl决定),但可以放置布局控件来实现多个任意 ...
- Oracle部署迁移手册
第1章 安装准备 1.1 安装环境 操作系统:Redhat6.5 x64 32核CPU 62G内存 系统盘300G 数据磁盘3T Oracle软件:Oracle Database 11g Enterp ...
- 从源码解析Electron的安装为什么这么慢
前言 Electron作为一款跨平台的桌面应用端解决方案已经风靡全球.作为开发者,我们几乎不用关心与操作系统的交互,直接通过Web前端技术与Electron提供的API就可以完成桌面应用端的开发. 然 ...
- Python异常代码含义对照表
Python常见的异常提示及含义对照表如下: 异常名称 描述 BaseException 所有异常的基类 SystemExit 解释器请求退出 KeyboardInterrupt 用户中断执行(通常是 ...