主要思想就是两端逼近,最后得到结果,0MS

#include <iostream>
#include <cstdlib>
#include <cstdio>
#include <cmath>
#include <algorithm> using namespace std; const double ep = 1e-; double deal(double n)
{
return *pow(n,) + *pow(n,) + *pow(n,) + *n + ; } int main()
{
int t,i;
double y;
scanf("%d",&t);
while (t--)
{
scanf("%lf",&y);
double lo = ,hi = ;
if(y<deal() || y>deal())
{
printf("No solution!\n");
continue;
}
else
{
double mid;
while(hi-lo>ep)
{
mid = (lo+hi)/;
if(deal(mid)>y)
{
hi = mid;
}
else
{
lo = mid;
}
}
printf("%.4lf\n",hi);
} }
return ;
}

HDU 2199 (二分法)的更多相关文章

  1. 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 == ...

  2. hdu 2199 Can you solve this equation? (二分法)

    Can you solve this equation? Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K ( ...

  3. 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 c ...

  4. hdu 2199 (二分)

    链接:http://acm.hdu.edu.cn/showproblem.php?pid=2199 Can you solve this equation? Time Limit: 2000/1000 ...

  5. 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 ...

  6. (二分搜索)Can you solve this equation? -- hdu -- 2199

    链接: http://acm.hdu.edu.cn/showproblem.php?pid=2199 Time Limit: 2000/1000 MS (Java/Others)    Memory ...

  7. 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 ...

  8. hdu 6288(二分法加精度处理问题)

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=6288 题意:给出a,b,k,n可满足(n^a)*(⌈log2n⌉)^b<=k ,求最大的n值三个 ...

  9. hdu 2199:Can you solve this equation?(二分搜索)

    Can you solve this equation? Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K ( ...

随机推荐

  1. 解决org.apache.lucene.store.AlreadyClosedException: this Directory is closed

    在Lucene中,关闭一个IndexWriter时抛出AlreadyClosedException异常: org.apache.lucene.store.AlreadyClosedException: ...

  2. gradle 常用命令参数

    参考文档 https://docs.gradle.org/current/userguide/userguide gradle -q 任务名(task ) 执行指定某一个task gradle -q ...

  3. Laravel 的核心概念

    工欲善其事,必先利其器.在开发Xblog的过程中,稍微领悟了一点Laravel的思想.确实如此,这篇文章读完你可能并不能从无到有写出一个博客,但知道Laravel的核心概念之后,当你再次写起Larav ...

  4. 资产管理 cmdb之ansible 获取服务器硬件、软件等信息

    cmdb抓取服务信息的方式有很多种,可以使用自动化工具saltstack.ansible.puppet,或者使用其它模块直接ssh远程连接抓取服务器信息.这里记录一下用ansible的API接口调用s ...

  5. Python数据结构之序列及其操作

    数据结构是计算机存储,组织数据的方式.数据结构是指相互之间存在一种或多种特定关系的数据元素的集合. 在Python中,最基本的数据结构为序列(sequence).序列中的每个元素都有编号:从0开始递增 ...

  6. dp--2019南昌网络赛B-Match Stick Game

    dp--2019南昌网络赛B-Match Stick Game Xiao Ming recently indulges in match stick game and he thinks he is ...

  7. redux概念介绍

    这一部分仅仅介绍react基本的概念,因为react不仅仅可以用在react中,还可以用在其他框架甚至原生 js 中.  所以这里只介绍通用的概念. redux使用场景 redux和vue中的vuex ...

  8. 【es6】数值扩展

  9. 09 jdk1.5的并发容器:ConcurrentHashMap

    一 概述 JDK5中添加了新的concurrent包,相对同步容器而言,并发容器通过一些机制改进了并发性能 因为同步容器将所有对容器状态的访问都串行化了,这样保证了线程的安全性,所以这种方法的代价就是 ...

  10. Visual Studio 2017 远程调试(Remote Debugger)应用

    I.远程调试情景 项目部署在远程服务器或非本地环境中,需要 处理应用中遇到的一些错误时 (不能直接附加进程或F5调试应用). II. 远程调试准备 1.远程服务器--操作系统和硬件要求 MSDN 操作 ...