Now,given the equation 8x^4 + 7x^3 + 2x^2 + 3x + 6 == Y,can you

find its solution between 0 and 100; Now please try your lucky. Input

The first line of the input contains an integer T(1<=T<=100) which

means the number of test cases. Then T lines follow, each line has a

real number Y (fabs(Y) <= 1e10); Output For each test case, you should

just output one real number(accurate up to 4 decimal places),which is

the solution of the equation,or “No solution!”,if there is no solution

for the equation between 0 and 100. Sample Input

2
100
-4
Sample Output
1.6152
No solution!
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
using namespace std; #define ll long long
#define db double
const int Len = 1e5+10; db Cal(db m)
{
return 8 * pow(m, 4) + 7 * pow(m, 3) + 2 * pow(m, 2) + 3 * m + 6;
} int main()
{
//freopen("A.txt","r",stdin);
int t;
cin >> t;
while(t --)
{
int n;
scanf("%d", &n);
db l = 0, r = 100;
if(Cal(0) > n || Cal(100) < n)
cout << "No solution!\n";
else
{
db m;
while(r - l >= 1e-10)
{
m = (l + r)/2;
if(Cal(m) > n)
r = m;
else
l = m;
}
printf("%.4lf\n", m);
}
} return 0;
}

C - Can you solve this equation? HDU - 2199(二分水题)的更多相关文章

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

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

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

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

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

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

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

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

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

  8. HDU 2199 Can you solve this equation? (二分 水题)

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

  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. startUML5.0中的tools下怎么没有java、c等选项

    这也是帮一个直系学妹弄得,哈哈~~~ 具体做法如下: 进入到StartUML\modules目录下,里面有很多文件夹,比如startuml-cpp.startuml-csharp等等, 进入到每个文件 ...

  2. 去除 inline-block 元素间距

    案例重现 布局时经常能发现inline元素和inline-block元素水平呈现的元素间,会存在着一些意想不到的间距,举例: .inline-block { display: inline-block ...

  3. 三星最先进EUV产线投用

    近日,三星宣布,在韩国华城工业园新开一条专司 EUV(极紫外光刻)技术的晶圆代工产线 V1,最次量产 7nm. 据悉,V1 产线/工厂 2018 年 2 月动工,2019 年下半年开始测试晶圆生产,首 ...

  4. Spring Boot入门系列(六)如何整合Mybatis实现增删改查

    前面介绍了Spring Boot 中的整合Thymeleaf前端html框架,同时也介绍了Thymeleaf 的用法.不清楚的朋友可以看看之前的文章:https://www.cnblogs.com/z ...

  5. RPA如何跑赢传统自动化和人工?

    过去的4年时间里,RPA(机器人流程自动化)一词,在Gartner的搜索引擎中一直排名前五.去年Gartner发表的调查数据中显示,RPA行业在2018年保持了60%以上的增长速度,从而成为全球增长最 ...

  6. shell脚本中的各种表达式介绍和使用

    #前言:在shell脚本中,有各种的表达式,包括有条件测试表达式,文件表达式,字符串表达式,整数表达式,接下来我们来了解一下他们的使用方法 1.条件测试表达式 #首先来看一下条件测试语法 #条件测试语 ...

  7. (转)解决windows live writer的段首缩进问题

    原文地址:http://blog.csdn.net/xiao_wanpeng/article/details/6381799 Windows live writer 默认是没有段首缩进的,并且不能修改 ...

  8. dpdk中QSBR具体实现

    目录 dpdk-QSBR实现 初始化 注册与注销 上线与下线 等待静默 附录 参考 dpdk-QSBR实现 dpdk19.01提供了qsbr模式的rcu库,其具体实现在lib/librte_rcu目录 ...

  9. js 验证输入框是否为空

    很多时候,菜鸟在对输入框是否输入值进行验证时,总会把输入“空字符串”这一状况给忽略掉.嗯,我就这样,所以记下,以后回忆下还是不错滴 <input type="text" id ...

  10. 在Linux环境安装redis步骤,且设置开机自动启动redis

    最近在linux环境安装了redis学习,目前已经安装成功且设置开机即启动状态,我把步骤流程记录了下来,分享给需要的小伙伴. 1.我在/usr/local/localsoftware/目录下创建了一个 ...