HDU 2199 Can you solve this equation? (二分 水题)
Can you solve this equation?
Now please try your lucky.
100
-4
No solution!
一道初学者的二分题,讲课用
#include <iostream>
#include <cstdio>
using namespace std; double y; double getfx(double x){
return 8*x*x*x*x + 7*x*x*x + 2*x*x + 3*x + 6;
} void computing(){
if(getfx(100)<y-1e-3 || getfx(0)>y+1e-3){
printf("No solution!\n");
return;
}
double l=0,r=100;
while(r-l>1e-6){
double mid=(l+r)/2;
if(getfx(mid)>y) r=mid;
else l=mid;
}
printf("%.4lf\n",r);
} int main(){
int t;
scanf("%d",&t);
while(t-- >0){
scanf("%lf",&y);
computing();
}
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? 二分
Can you solve this equation? Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K ( ...
- 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 ...
- 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?【二分查找】
解题思路:给出一个方程 8*x^4 + 7*x^3 + 2*x^2 + 3*x + 6 == Y,求方程的解. 首先判断方程是否有解,因为该函数在实数范围内是连续的,所以只需使y的值满足f(0)< ...
- hdu 2199 Can you solve this equation?(二分搜索)
Can you solve this equation? Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K ( ...
随机推荐
- Android:实现退出确认对话框
在Android平台上捕获Back键的事件,super.onBackPressed()是执行系统的默认动作,就是退出当前activity,我们要做的就是重写onBackPressed()函数, pub ...
- Git教程之多人协作
当你从远程仓库克隆时,实际上Git自动把本地的master分支和远程的master分支对应起来了,并且,远程仓库的默认名称是origin.要查看远程库的信息,用git remote:
- linux netcat命令
netcat是网络工具中的“瑞士军刀”,它能通过TCP和UDP在网络中读写数据.通过与其他工具结合和重定向,你可以在脚本中以多种方式使用它.使用netcat命令所能完成的事情令人惊讶. netcat所 ...
- QMenu的个性化定制
经常使用菜单,菜单的定制相当重要,普通的样式设置不难,一般需求足以实现(QMenu + QAction).如果要足够个性,则需要进行一定的定制. 说起定制,其实也是利用Qt中现成的组件进行组装 ...
- sublime text2卸载和重新安装
很多同学使用 sublime text2 的时候,出现一些奇怪的bug,且重启无法修复. 于是,就会想到卸载 sublime text2 再重新安装. 然而,你会发现,重新安装后,这个bug任然存在, ...
- html5自带表单验证-美化改造
神奇的代码 暂且叫做html5.css /* === HTML5 validation styles === */ .myform select:required, .myform input:req ...
- innodb 悲观锁,乐观锁
转 http://www.cnblogs.com/chenwenbiao/archive/2012/06/06/2537508.html CREATE TABLE `products` ( `id` ...
- [转载]Java的内存回收机制
转自:http://www.admin10000.com/document/1671.html 在Java中,它的内存管理包括两方面:内存分配(创建Java对象的时候)和内存回收,这两方面工作都是由J ...
- apache开源项目--Shiro
安全是企业应用中不可缺少的功能,在众多权限框架中,Shiro(其前身是JSecurity)因其简单而又不失强大的特点引起了不少开发者的注 意.随着Grails的关注度越来越高,在Grails社区也出现 ...
- MVC三个IOC注入点之Ninject使用示例
群里一个技术大牛说MVC有三个注入点,但我只会一个DefaultControllerFactory. 在群友的帮助下,我大致了解了下: IControllerFactory=>IDependen ...