D - Can you solve this equation?

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.

InputThe 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);OutputFor 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!


 #include<iostream>
#include<cmath>
using namespace std; double f(double x){
return (*pow(x,) + *pow(x,) + *pow(x,) + *x + );
} int main()
{
int t;
double m,n;
scanf("%d",&t);
while(t--){
scanf("%lf",&m);
if(f()>m||f()<m){
printf("No solution!\n");
continue;
}
double left = , right = , mid;
while(fabs(f(mid)-m) > 1e-){
mid=(left + right)/;
if((f(mid) > m)) right = mid;
else if(f(mid)<m) left=mid;
}
printf("%.4lf\n",mid);
}
return ;
}

二分-D - Can you solve this equation?的更多相关文章

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

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

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

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

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

  7. hdoj 2199 Can you solve this equation?【浮点型数据二分】

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

  8. Can you solve this equation?(二分)

    Can you solve this equation? Time Limit : 2000/1000ms (Java/Other)   Memory Limit : 32768/32768K (Ja ...

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

随机推荐

  1. 什么是AOP面向切面编程思想

    一.什么是AOP? 1.AOP不是一种语言,是一种编程范式 常见的编程范式: 面向过程.面向对象.函数式编程.事件驱动编程等 2.AOP可以解决特定问题,不能解决所有问题. 3.是面向对象的补充,不是 ...

  2. Win10好用的快捷键

    Win10好用的快捷键 Win键,Tab键,空格键,上下左右方向键,Enter键,Shift+Tab键 Win键--Tab键--上下左右方向键--Enter确定或者---空格键(确定的意思),Ente ...

  3. SpringBoot整合NoSql--(三)Redis集群

    (1)集群原理 在Redis集群中,所有的Redis节点彼此互联,节点内部使用二进制协议优化传输速度和带宽. 当一个节点挂掉后,集群中超过半数的节点检测失效时才认为该节点已失效.不同于Tomcat集群 ...

  4. 使用elementui树形控件写项目小结

    使用tree pagination serch table 实现功能 项目难点主要解析后台传递的代码,线性转树形,这儿加上一个大神的解析 https://blog.csdn.net/dandanzmc ...

  5. Angular4.0环境搭建

    1.安装nodejs 先装nodejs,如果你的电脑已经装过了,最好确认是比较新的版本,否则可能会出问题 下载地址:https://nodejs.org/en/download/ 安装过程很简单,一直 ...

  6. shell脚本监测进程并重启

    本人实例: #!/bin/bash ps -ef | grep elastic | grep -v grepif [ $? -ne 0 ]thenecho "start process... ...

  7. C#常见基础算法

    namespace 面试常见算法 { class Program { static void Main(string[] args) { ); Console.WriteLine(n1); Test2 ...

  8. 报表生成(POI,jquery.table2excel.js,Echarts)

    最近公司要弄个报表相关的功能,话不多说,先上图 前一种是POI 生成的,后一种是Echarts生成的.报表我想大家都不陌生,基本上在公司业务中都会使用到.先说说POI,jquery.table2exc ...

  9. 嵊州D5T2 折纸 folding

    折纸 folding [问题描述] 在非常紧张的 NOIP 考试中,有人喜欢啃指甲,有人喜欢转铅笔,有人喜欢撕 纸条,……而小 x 喜欢迷折纸. 现有一个 W * H 的矩形纸张,监考老师想知道,小 ...

  10. 安装Kibana到Linux(源码)

    运行环境 系统版本:CentOS Linux release 7.3.1611 (Core) 软件版本:Kibana-7.1.0 硬件要求:最低2核4GB 安装过程 1.源码安装JDK 1.1.从官网 ...