Can you solve this equation?
Can you solve this equation? |
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) |
Total Submission(s): 1182 Accepted Submission(s): 558 |
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 |
Sample Output
1.6152 |
Author
Redow
|
Recommend
lcy
|
#include<bits/stdc++.h>
#define op 1e-8
using namespace std;
double F(double x)
{
return *x*x*x*x+*x*x*x+*x*x+*x+;
}
int main()
{
//freopen("C:\\Users\\acer\\Desktop\\in.txt","r",stdin);
int t;
double n;
scanf("%d",&t);
while(t--)
{
scanf("%lf",&n);
if(n<||n>)
{
puts("No solution!");
continue;
}
double l=,r=,mid;
while(fabs(r-l)>op)
{
mid=(l+r)*1.0/;
if(F(mid)>n)
r=mid;
else
l=mid;
}
printf("%.4lf\n",l);
}
return ;
}
Can you solve this equation?的更多相关文章
- 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 ...
- hdu 2199 Can you solve this equation?(二分搜索)
Can you solve this equation? Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K ( ...
- hdu 2199:Can you solve this equation?(二分搜索)
Can you solve this equation? Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K ( ...
- 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 ...
- HDU 2199 Can you solve this equation? (二分 水题)
Can you solve this equation? Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K ( ...
- hdoj 2199 Can you solve this equation?【浮点型数据二分】
Can you solve this equation? Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K ( ...
- Can you solve this equation?(二分)
Can you solve this equation? Time Limit : 2000/1000ms (Java/Other) Memory Limit : 32768/32768K (Ja ...
- HDU 2199 Can you solve this equation(二分答案)
Can you solve this equation? Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K ( ...
- HDU - 2199 Can you solve this equation? 二分 简单题
Can you solve this equation? Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K ( ...
随机推荐
- 两句话动态修改table数据并提交到后台
//为所有的input 添加click事件,我将对象的id放入到name属性中,行数放入到alt属性中 $("input").click(function(obj){ //获得当前 ...
- Sql Server——查询(一)
查询数据就是对数据库中的数据进行筛选显示.显示数据的表格只是一个"虚拟表". 查询 (1)对列的筛选: 1.查询表中所有数据: select * from 表名 ...
- AngularJS -- HTML 编译器
点击查看AngularJS系列目录 转载请注明出处:http://www.cnblogs.com/leosx/ HTML Compiler Overview(HTML 编译器 概要) AngularJ ...
- Linux学习——yum学习和光盘yum源搭建
在rmp安装的时代,rpm包依赖让安装人员头大,而且头疼,有了yum后整个的安装更加简单和方便. yum源文件 1.yum源的介绍: 将所有的软件包放到官方服务器上,当进行yum在线安装时,可以自动解 ...
- 【重点突破】——Canvas技术绘制随机改变的验证码
一.引言 本文主要是我在学习Canvas技术绘图时的一个小练习,绘制随机改变的验证码图片,虽然真正的项目里不这么做,但这个练习是一个掌握Canvas技术很好的综合练习.(真正的项目中验证码图片使用服务 ...
- 2014 Benelux Algorithm Programming Contest (BAPC 14)E
题目链接:https://vjudge.net/contest/187496#problem/E E Excellent Engineers You are working for an agency ...
- Android 实现UI设计
1. 计算屏幕高度,宽度代码(Activity中) DisplayMetrics outMetrics = new DisplayMetrics(); getWindowManager().getDe ...
- 学习flex布局(弹性布局)
Flex是Flexible Box的缩写,意为弹性布局.是W3C早期提出的一个新的布局方案.可以便捷的实现页面布局,目前较高版本的主流浏览器都能兼容,兼容情况如下: Flex在移动端开发上已是主流,比 ...
- hdu 1018 共同交流~
Big Number Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total ...
- ajax 轮询 和 php长连接
只看加粗的字体 js 部分 1: ajax 成功回调函数中 一定要用时间函数间隔调用 get_comment(). get_comments('init'); function ...