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. 企业Shell面试题及企业运维实战案例(三)

    1.企业Shell面试题1:批量生成随机字符文件名案例 使用for循环在/oldboy目录下批量创建10个html文件,其中每个文件需要包含10个随机小写字母加固定字符串oldboy,名称示例如下: ...

  2. No configuration found for this host:al

    想尝试多个agent来进行传输数据其中的一个配置文件如下: al.sources = r1al.sinks = k1al.channels = c1 al.sources.r1.type = avro ...

  3. QP之QF原理

    1.QP简介: 量子平台(Quantum Platform, 简称QP)是一个用于实时嵌入式系统的软件框架,QP是轻量级的.开源的.基于层次式状态机的.事件驱动的平台. QP包括事件处理器(QEP). ...

  4. PADS快捷键

    问:在pads layout中怎样显示或隐藏铺铜的效果 答: 无模命令:po 或者spo 前者是平面层 后者是混合层. 同时你可以在ctrl+alt+c 色彩项中关闭 copper . 使用 无模命令 ...

  5. Java学习笔记九:Java的循环跳转语句

    Java的循环跳转语句 一:Java循环跳转语句之break: 生活中,我们经常会因为某些原因中断既定的任务安排.如在参加 10000 米长跑时,才跑了 500 米就由于体力不支,需要退出比赛.在 J ...

  6. python爬取豆瓣流浪地球影评,生成词云

    代码很简单,一看就懂. (没有模拟点击,所以都是未展开的) 地址: https://movie.douban.com/subject/26266893/reviews?rating=&star ...

  7. node session会话

    会话机制: 浏览器-->服务器 浏览器<--服务器 (产生一个会话id,保存在cookie中) 浏览器-->服务器(服务器根据会话id关联到相应数据信息体data) var expr ...

  8. UVA11988 Broken Keyboard (a.k.a. Beiju Text)【数组模拟链表】

    参考:https://blog.csdn.net/lianai911/article/details/41831645 #include <iostream> #include <c ...

  9. UVA 1593 Alignment of Code(紫书习题5-1 字符串流)

    You are working in a team that writes Incredibly Customizable Programming Codewriter (ICPC) which is ...

  10. ChemDraw Std 14性价比最高版本,即将下架

    虽然ChemDraw Std 14是ChemOffice®14的基础组件,但是基础功能涵盖全面,是教育专供产品.根据官方最新消息ChemDraw系列软件产品线将进行全面的升级,ChemOffice®1 ...