主要思想就是两端逼近,最后得到结果,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. spring-mybatis源码追踪

    启用一个扫描类 <bean class="org.mybatis.spring.mapper.MapperScannerConfigurer"> <propert ...

  2. 初探APT 攻击

    作者:joe       所属团队:Arctic Shell 本文编写参考: https://www.freebuf.com/vuls/175280.html https://www.freebuf. ...

  3. [Swift]遍历字符串

    Swift中无法再使用传统形式的for循环. //传统for循环形式不适用于Swift for(单次表达式;条件表达式;末尾循环体){中间循环体:} 字符串遍历方法1:使用该indices属性可以访问 ...

  4. graphviz画图与中文乱码等问题总结

    最近想写一些文档,画一些程序的逻辑图,用了vision,markdown等软件感觉不怎么好用,于是找到graphviz,这款强大的软件.下面介绍一些入门,还有自己在用的过程中遇到的问题 1.中文乱码的 ...

  5. 3.1 High Availability

    摘要: 出处:黑洞中的奇点 的博客 http://www.cnblogs.com/kelvin19840813/ 您的支持是对博主最大的鼓励,感谢您的认真阅读.本文版权归作者所有,欢迎转载,但请保留该 ...

  6. FTP在docker容器中上传失败解决,改为被动模式

    package com.mayocase.takeout.utils; import org.apache.commons.net.ftp.FTPClient; import org.apache.c ...

  7. 说说MySQL权限

    前言 今天继续MySQL系列文章,讲讲MySQL权限相关的内容.我们都知道,在写系统的时候,都会有权限相关的服务,以达到权限控制的目的.以最简单的权限菜单为例: 管理员拥有最大权限,可以查看系统下所有 ...

  8. eclipse左边的项目栏消失的处理方法

    window —–> Show View —–> other —–> package Explorer

  9. slatstack高效运维

    一.简介 saltstack是由thomas Hatch于2011年创建的一个开源项目,设计初衷是为了实现一个快速的远程执行系统. 二.诞生的背景 系统管理员日常会进行大量的重复性操作,例如安装软件, ...

  10. 查看APK包签名的方法。

    1.查看 keystore $ keytool -list -keystore debug.keystore 结果: Keystore type: JKS Keystore provider: SUN ...