传送门:

http://acm.hdu.edu.cn/showproblem.php?pid=2199

Can you solve this equation?

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

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 3400 1969 1551 
 
代码:
#include<iostream>
#include<algorithm>
#include<stdio.h>
#include<queue>
#include<set>
#include<map>
#include<string>
#include<memory.h>
#include<math.h>
#define eps 1e-7
using namespace std;
int y;
double f(double x)
{
return *pow(x,)+*pow(x,)+*pow(x,)+*x+-y;
}
double ff()
{
double l=,h=;
double mid;
while(h-l>=eps)//精度控制
{
mid=(l+h)/;
if(f(mid)>)
{
h=mid;
}else
{
l=mid;
}
}
return mid;
}
int main()
{
int t;
cin>>t;
while(t--)
{
cin>>y;
if(f()*f()>)//与x轴无交点了
cout<<"No solution!"<<endl;
else
printf("%0.4lf\n",ff());
}
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?(高精度二分)

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

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

  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?(二分搜索)

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

  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. 设置Log文件每天生成一个(wamp)

    打开 Wamp的 httpd.conf文件 把下面两句话拷贝进去即可: 1.设置错误log的,    " 2.设置访问log的    " common    说明:bin/rota ...

  2. ssh免密码登录快速配置方法

    环境需求: 两台Linux主机   A (192.168.3.101)和 B(192.168.3.102),如何使用主机 A 免密码登录 主机B ? 配置步骤: 首页登录主机 A ,在主机A上生成自己 ...

  3. QQ会员2018春节红包抵扣券项目背后的故事

    欢迎大家前往腾讯云+社区,获取更多腾讯海量技术实践干货哦~ 1. 活动数据 截止3月1日手Q运动红包会员礼包发放核销数据 参与红包活动用户数:2亿+ 发券峰值:52w/min 2. 需求背景 2.1 ...

  4. CF 303C——Minimum Modular——————【剪枝】

    Minimum Modular time limit per test 2 seconds memory limit per test 256 megabytes input standard inp ...

  5. win10 MySQL8.0 zip包安装及问题解决

    1.在官网下载zip包 https://dev.mysql.com/downloads/mysql/ 2.将zip包解压到自己的工作目录中 3.配置环境变量 1)添加环境变量 MYSQL_HOME E ...

  6. PHP 文件锁和常用文件函数

    文件锁 bool flock ( int handle, int operation [, int &wouldblock] );flock() 操作的 handle 必须是一个已经打开的文件 ...

  7. node-sass安装失败的解决办法

    安装node-sass一直失败,说起来还是自己把自己坑了,在度娘的帮助下我找到了下面这些资料: 资料1:FQ后再安装node-sass (无效),我使用的是lantern工具翻的墙 资料2:将yarn ...

  8. 【代码笔记】Java——远程监控、反射、代理、内省机制

    远程控制的基本原理 远程控制(RemoteControl)拥有控制端和被控端双方. 控制方通过请求,取得对远端的操作,实现远端的事件回放功能,同时,应该看得到远端桌面的画面.而被控方必须在建立Serv ...

  9. em和px

    在国内网站中,包括三大门户,以及“引领”中国网站设计潮流的蓝色理想,ChinaUI等都是使用了px作为字体单位.只有百度好歹做了个可调的表率.而 在大洋彼岸,几乎所有的主流站点都使用em作为字体单位, ...

  10. javascript实现数据结构: 串的块链存储表示

    和线性表的链式存储结构相类似,也可采用链式方式存储串值.由于串结构的特殊性--结构中的每个数据元素是一个字符,则用链表存储串值时,存在一个“结点大小”的问题,即每个结点可以存放一个字符,也可以存放多个 ...