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.

InputThe 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);OutputFor 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! 思路:二分查找答案问题,设置精度后直接查找即可,代码如下:
double Y;

double check(double x) {
return * (x * x * x * x) + * (x * x * x) + * (x * x) + * x + ;
} int main() {
int T;
scanf("%d", &T);
while(T--) {
double l = 0.0, r = 100.0, mid;
scanf("%lf", &Y);
if(check(0.0) > Y || check(100.0) < Y) {
printf("No solution!\n");
continue;
}
while(r - l > 1e-) {
mid = (r + l) / 2.0;
if(check(mid) - Y > )
r = mid;
else
l = mid;
}
printf("%.4lf\n", mid);
}
return ;
}
												

Day3-K-Can you solve this equation? HDU2199的更多相关文章

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

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

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

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

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

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

  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. 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. hdoj 2199 Can you solve this equation?【浮点型数据二分】

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

  8. Can you solve this equation?

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

  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. Springboot学习:日志

    介绍 市面上的日志框架: JUL.JCL.Jboss-logging.logback.log4j.log4j2.slf4j.... 日志门面 (日志的抽象层) 日志实现 JCL(Jakarta Com ...

  2. 洛谷 P3808 【模板】AC自动机(简单版) (AC自动机优化板子)

    题中有一个坑点,就是模式串可以相同,并且全部计数. #include <bits/stdc++.h> using namespace std; const int maxn=1e6+10; ...

  3. 【代码总结】GD库中简单的验证码

    大体思路: 代码部分: <?php //1.创建画布 $img = imagecreatetruecolor(100,30); //2.设置颜色 值越小,颜色越深 $color1 = image ...

  4. WinForm开发(4)——使用Visual-Studio-2010-打包安装程序

    打包程序: 1,解决方案—右键菜单“添加”—新建项目—其他项目类型—安装和部署—Visual Studio Installer—安装项目,输入名称Setup1,点“确定” 2,添加开始程序中的文件夹: ...

  5. 阅读build to win的个人感想

    一个程序员要向各个方面学习,向市场.向用户学习等,不能局限于一方面.除此以外还要有自己的想法,要懂得创新,也需要在各个方面都有所突破,有所超越,实力才是取得胜利的根关键.

  6. 第七届蓝桥杯javaB组真题解析-抽签(第五题)

    题目 /* 抽签 X星球要派出一个5人组成的观察团前往W星. 其中: A国最多可以派出4人. B国最多可以派出2人. C国最多可以派出2人. .... 那么最终派往W星的观察团会有多少种国别的不同组合 ...

  7. 栈结构Stack

    package seday12; import java.util.Deque; import java.util.LinkedList; /** * @author xingsir * 栈结构. 栈 ...

  8. selenium webdriver 定位元素 第一部分

    static final WebDriver driver = ExplorerBase.IESetting(); // 实例化一个浏览器对象 @Test //@Ignore public void ...

  9. loadrunner 接口测试实战

    直接上代码: web_reg_save_param("Name",   //这个函数是为了获取服务器返回的值.我这个接口的返回值是这样子的 //将服务器返回的值放在Name里,Na ...

  10. Python基础-2 变量与常量

    变量与常量 变量:在程序运行过程中,值会发生变化的量 常量:在程序运行过程中,值不会发生变化的量 无论是变量还是常量,在创建时都会在内存中开辟一块空间,用于保存它的值. 这里有一点需要注意的是,在py ...