Now,given the equation 8*x^4 + 7*x^3 + 2*x^2 + 3*x + 6 == Y,can you find its solution between 0 and 100;
Now please try your lucky.
#include<iostream>
#include<math.h>
#include<stdio.h>
using namespace std;
double deal(double x)
{
return 8*pow(x,4)+7*pow(x,3)+2*pow(x,2)+3*x+6;
}
int main()
{
int t;
scanf("%d",&t);
while(t--)
{
double x,sum,l=0,r=100;
scanf("%lf",&sum);
if(sum<deal(0)||sum>deal(100.0))
{
printf("No solution!\n");
continue;
}
else
{
double mid;
int flg=0;
while(r-l>1e-6)
{
mid=(l+r)/2;
if(deal(mid)>sum)
r=mid;
else
l=mid;
}
printf("%.4lf\n",r);
}
}
return 0;
}

hdu2199(高精度二分模版)的更多相关文章

  1. POJ 2109 Power of Cryptography【高精度+二分 Or double水过~~】

    题目链接: http://poj.org/problem?id=2109 参考: http://blog.csdn.net/code_pang/article/details/8263971 题意: ...

  2. poj 1064 高精度 二分

    Cable master Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 32191 Accepted: 6888 Descrip ...

  3. poj2018(高精度二分+dp)

    题意:给你n个数,要你在这n个数里面找到一些连续的数,这些数的数量大于等于m,并且他们的平均值在这n个数里面是最大的....... 思路:先把n个数的最大最小值确定,然后二分枚举平均值,对于每一个连续 ...

  4. Can you solve this equation?---hdu2199(二分)

    http://acm.hdu.edu.cn/showproblem.php?pid=2199 给出y的值求x: 8*x^4 + 7*x^3 + 2*x^2 + 3*x + 6 = Y x是0到100的 ...

  5. CodeForce-782B The Meeting Place Cannot Be Changed(高精度二分)

    https://vjudge.net/problem/CodeForces-782B B. The Meeting Place Cannot Be Changed time limit per tes ...

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

  7. [HNOI2004]高精度开根

    题目:洛谷P2293.BZOJ1213. 题目大意:给你$n,k(n\leq 10^{10000},k\leq 50)$,求$\lfloor \sqrt[k]{n}\rfloor$. 解题思路:高精度 ...

  8. NOIP初赛:完善程序做题技巧

    最近写的文章好像还很多的.那么今天我们来讨论NOIP初赛的题型--完善程序.完善程序相对是比较难的题目了.全卷100分,完善程序占了大概26分,占比非常大.如果和英语考试试卷做比较,相当于首字母填空( ...

  9. [POJ2109]Power of Cryptography

    [POJ2109]Power of Cryptography 试题描述 Current work in cryptography involves (among other things) large ...

随机推荐

  1. esp8266烧录Html文件,实现内置网页控制设备!

    代码地址如下:http://www.demodashi.com/demo/14321.html 一.前言: 这个月也快结束了,时间真快,我服务器知识自学依然在路途中,这几天听到热点网页配置esp826 ...

  2. 利用cURL会话获取一个网页

    1.curl_init 作用:     初始化一个新的会话.返回一个cURL句柄,供curl_setopt(), curl_exec()和curl_close() 函数使用. 格式:    curl_ ...

  3. reindex-maven 私服(nexus)架设以及项目管理中遇到的问题及解决方案(updating)

    ---    用maven 的过程中 大问题小问题实在是不少 ,就不一篇文章一篇文章的写了,干脆写在一起 ---- -------  nexus 加索引 点击Administration菜单下面的Re ...

  4. oracle客户端服务端字符集-解决乱码

    查询server段字符集 select userenv('language') from dual 查询client段字符集 select * from v$nls_parameters NLS_LA ...

  5. java获取某个范围内的一个随机数

    一.取模操作 public static void main(String[] args){ for (int i = 1; i <= 20; i++){ int j = i % 11; Sys ...

  6. 去掉cb中括号的匹配

    Settings->Editor->General settings->Indent options->Brace completion``

  7. ASP.NET MVC之Layout布局与@RenderBody、@RenderPage、@RenderSection

    @RenderBody @RenderBody是布局页(_Layout.cshtml)通过占位符@RenderBody占用独立部分,当创建基于此布局页的试图时,视图的内容会和布局页合并,而新创建的视图 ...

  8. Win32:引用头文件

    1.首先,在代码文件头部使用#include来包含任何头文件(扩展名为.h或者.hpp的文件)都不会“产生”额外的函数. 我们可以说,包含一个头文件之后,该头文件内部已经定义的一些变量,宏,函数等等资 ...

  9. PLSQL_统计信息系列08_统计信息生成和还原

    2015-02-01 Created By BaoXinjian

  10. mysql 返回多列的方式

    SELECT * FROM (SELECT 'success' as _result) a,(SELECT @gid as gid) b;