Can you solve this equation?

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

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:  2289 2298 2141 3400 1969 
 
 //15MS    248K    537 B    C++
/* 题意:
给出一条公式:
8*x^4 + 7*x^3 + 2*x^2 + 3*x + 6 == Y
和Y的值,要求你在(0,100)的范围内求4位小数精确解 二分法:
先排除无解的情况,因为函数在(0,100)单调递增,最小值为6,
最大值为fac(100),先排除无解情况然后用二分法计算 */
#include<stdio.h>
#define e 1e-7
double fac(double a)
{
return (*a*a*a*a+*a*a*a+*a*a+*a+);
}
int main(void)
{
int t;
double n;
scanf("%d",&t);
while(t--)
{
scanf("%lf",&n);
if(n< || n>fac()){
puts("No solution!");continue;
}
double l=;
double r=;
while(r-l>e){
double mid=(l+r)/;
if(fac(mid)>n) r=mid;
else l=mid;
}
printf("%.4lf\n",r);
}
return ;
}

color: #800080;

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

  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. 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. JS高级. 04 增删改查面向对象版歌曲管理、递归、

    增 数组.push() 删 数组.splice(开始删除索引,删除几个) 在当前对象中调用当前对象的方法中和属性,必须用this调用 nodeType判断节点类型 节点.nodeType ==  1: ...

  2. 关于mysql连接时候出现"error 2003: can't connect to mysql server on 'localhost'(10061)问题的解决

    天,在使用navicat Premium 连接数据库时,出现了一个弹出窗口显示: "error 2003: can't connect to mysql server on 'localho ...

  3. go web cookie和session

    cookie是存储在浏览器端,session是服务器端 cookie是有时间限制的,分会话cookie和持久cookie,如果不设置时间,那周期就是创建到浏览器关闭为止.这种是会话cookie,一般保 ...

  4. GDOI DAY1游记

    今天,是本蒟蒻的第一次参加GDOI,真激动! 今天,是GDOI第一天,昨天熬夜打代码,今天早上状态十分不好,于是... 进入了考场,叫我们自由打一会代码,于是...打了一坨AC机,重要的是错了(额.. ...

  5. 最小生成树算法 1.Prim算法

    最小生成树(MST):一个有N个点的图,边一定是大于等于N-1条边的.在这些边中选择N-1条出来,连接所有N个点.这N-1条边的边权之和是所有方案中最小的. Prim算法的时间复杂度时O(n^2)的, ...

  6. Tensorflow之MNIST的最佳实践思路总结

    Tensorflow之MNIST的最佳实践思路总结   在上两篇文章中已经总结出了深层神经网络常用方法和Tensorflow的最佳实践所需要的知识点,如果对这些基础不熟悉,可以返回去看一下.在< ...

  7. spark优化系列一:参数介绍

    1 spark on yarn常用属性介绍 属性名 默认值 属性说明 spark.yarn.am.memory 512m 在客户端模式(client mode)下,yarn应用master使用的内存数 ...

  8. Django中的select_related与prefetch_related

      Django是一个基于Python的网站开发框架,一个很重要的特点就是Battery Included,简单来说就是包含了常规开发中所需要的一切东西,包括但不限于完整的ORM模型.中间件.会话处理 ...

  9. cloudera manager服务迁移(scm数据库在postgresql上,其他amon,rman,oozie,metastore等在mysql上)

    公司线上大数据集群,之前用的是公有云主机,现在换成了自己idc机房机器,需要服务迁移,已下为测试: 1.备份原postgresql数据库: pg_dump -U scm scm > scm.sq ...

  10. CC3100BoosterPack和CC31XXEMUBOOST板子的测试

    1. 先测试右边的CC3100BoosterPack,测试发现LDO坏了,无法输出3.3V,所以只能用左边的板子供电. 2. 插上CC31XXEMUBOOST板子的J1,两个板子插在一起,等待驱动安装 ...