Can you solve this equation?

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 6763    Accepted Submission(s): 3154

Problem Description
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.
 
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!
 
Author
Redow
 
Recommend
lcy   |   We have carefully selected several similar problems for you:  2899 2289 2298 2141 3400 
 
 
 /*
对于精度,我表示囧。
我以为,保留4位小数,就到1e-5就可以了。 */ #include<iostream>
#include<stdio.h>
#include<cstring>
#include<cstdlib>
#include<math.h>
using namespace std; double fun(double x)
{
return *x*x*x*x+*x*x*x+*x*x+*x+;
}
void EF(double l,double r,double Y)
{
double mid;
while(r-l>1e-)
{
mid=(l+r)/;
double ans=fun(mid);
if( ans >Y )
r=mid-1e-;
else l=mid+1e-;
}
printf("%.4lf\n",(l+r)/);
}
int main()
{
int T;
double Y;
scanf("%d",&T);
{
while(T--)
{
scanf("%lf",&Y);
if( fun(0.0)>Y || fun(100.0)<Y)
printf("No solution!\n");
else
EF(0.0,100.0,Y);
}
}
return ;
}

hdu 2199 Can you solve this equation? 二分的更多相关文章

  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? 二分 简单题

    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?(高精度二分)

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

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

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

  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?【二分查找】

    解题思路:给出一个方程 8*x^4 + 7*x^3 + 2*x^2 + 3*x + 6 == Y,求方程的解. 首先判断方程是否有解,因为该函数在实数范围内是连续的,所以只需使y的值满足f(0)< ...

  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. Enum枚举法

    java enum(枚举)使用详解 + 总结   enum 的全称为 enumeration, 是 JDK 1.5  中引入的新特性,存放在 java.lang 包中. 下面是我在使用 enum 过程 ...

  2. web站点启用https (二)

    接上篇内容 二.实际配置案例 实验案例:为web站点启用https 实验环境:seven公司有一个web站点,域名为www.seven.com,启用的身份验证方式是基本验证方式.随着业务发展想成为网上 ...

  3. Description &&debugDescription && runtime(debug模式下调试model)

    description 在开发过程中, 往往会有很多的model来装载属性. 而在开发期间经常会进行调试查看model里的属性值是否正确. 那么问题来了, 在objective-c里使用NSLog(& ...

  4. OmniMarkupPreviewer 404

    Here is the answer: Sublime Text > Preferences > Package Settings > OmniMarkupPreviewer > ...

  5. mongodb 两台互为主从

    主机A [root@mysql_master zhxf]# cat docker-compose.yml version: '3' services: mongo_rs1: image: mongo: ...

  6. C++类的构造函数及定义

    定义一个普通的类时,一定要定义它自己的构造函数.原因有三:第一个原因是编译器只有在发现类不包含任何构造函数的情况下才会替我们生成一个默认的构造函数,一旦我们定义了一些其他的构造函数,那么除非我们再定义 ...

  7. JS实现值复制

    在JS中对象一般都是传地址,后续修改也会影响原始数据.例如这样. var a={ b:"b" }; var c=a; c.b="c"; console.log( ...

  8. java使用freemarker生成word文档

    1.原料 开源jar包freemarker.eclipse.一份模板word文档 2.首先设计模板word文档 一般,通过程序输出的word文档的格式是固定的,例如建立一个表格,将表格的标题写好,表格 ...

  9. 快速创建SpringBoot+SSM解析

    此处使用IDEA快速搭建SpringBoot应用,首先用SpringBoot搭建WEB工程: 然后点击Next生成项目,首次生成可能有点慢,下次创建的时候就会快很多,生成后的目录结构如下: 我们更改下 ...

  10. python-fifo管道文件通信

    #!/usr/bin/python #coding=utf-8 import os,sys,multiprocessing,time try: os.mkfifo('file') except :pa ...