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 ( ...
随机推荐
- 洛谷P1309——迷宫(傻瓜DFS)
题目背景 迷宫 [问题描述] 给定一个N*M方格的迷宫,迷宫里有T处障碍,障碍处不可通过.给定起点坐标和 终点坐标,问: 每个方格最多经过1次,有多少种从起点坐标到终点坐标的方案.在迷宫 中移动有上下 ...
- jmeter监控linux服务器资源
https://blog.csdn.net/weixin_38102592/article/details/100136375 https://blog.csdn.net/liuqiuxiu/arti ...
- javascript 高阶函数 实现 AOP 面向切面编程 Aspect Oriented Programming
AOP的主要作用是吧一些跟核心业务逻辑模块无关的功能 -日志统计, 安全控制, 异常处理- 抽离出来, 再通过"动态织入"的方式掺入业务逻辑模块中. 这里通过扩展Function. ...
- JMeter脚本开发
什么是jmeter脚本 用户操作系统的动作流程 用户操作系统的请求 类似演戏的剧本 怎么快速开发漂亮的jmeter脚本 准确 快速 漂亮,脚本逻辑清晰,维护性高 脚本开发方案 代理 http代理服务器 ...
- python二级 第七套
第一部分 基本操作 第一题 1.format() 故名思意 就是格式化什么东西.所以你就是将你 需要格式化的东西 放在里面就行了 . format(s) 对s 有要求 就是 int(s) ...
- P4542-[ZJOI2011]营救皮卡丘【费用流,Floyd】
正题 题目链接:https://www.luogu.com.cn/problem/P4542 题目大意 给出\(n+1\)个点\(m\)条边的无向图,\(k\)个人开始在\(0\)号点,一个人进入\( ...
- 在Anaconda环境下安装Tensorflow
安装Anaconda 下载Anaconda 个人版Individual Edition.如果下载速度慢,可以复制下载链接到迅雷或者在清华大学开源镜像站TUNA中找合适的版本. 注意在安装过程中的&qu ...
- 【SpringBoot技术专题】「权限校验专区」Shiro整合JWT授权和认证实现
本章介绍一下常用的认证框架Shiro结合springboot以及集合jwt快速带您开发完成一个认证框架机制. Maven配置依赖 <dependency> <groupId>o ...
- Go语言之Goroutine与信道、异常处理
一.Goroutine Go 协程可以看做成一个轻量级的线程,Go 协程相比于线程的优势: Goroutine 的成本更低大小只有 2 kb 左右,线程有几个兆. Goroutine 会复用线程,比如 ...
- python 注册 gin consul
import requests headers = { "contentType": "application/json" } def register(nam ...