二分-D - Can you solve this equation?
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
-4Sample 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?的更多相关文章
- 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? 二分 简单题
Can you solve this equation? Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K ( ...
- hdu2199Can 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 ...
- 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?(二分精度)
HDU 2199 Can you solve this equation? Now,given the equation 8*x^4 + 7*x^3 + 2*x^2 + 3*x + 6 == ...
随机推荐
- MFC/QT 学习笔记(一)——认识windows基础库
MFC (微软基础类库),Windows系统平台做GUI尚且OK,但不支持跨平台. //Windows消息机制: //1.SDK与API Software Development Kit,为特定软件框 ...
- PHP0023:PHP 相册管理案例
- MySQL分析工具explain介绍
EXPLAIN是MySQl必不可少的一个分析工具,主要用来测试sql语句的性能及对sql语句的优化,或者说模拟优化器执行SQL语句. 简单的说是execute plan, 获取MySQL数据库的执行计 ...
- springboot + mybatis 支持oracle和mysql切换含源码
1.springboot 启动类加入bean 如下 // DatabaseIdProvider元素主要是为了支持不同的数据库@Beanpublic DatabaseIdProvider getData ...
- 企业应用开发的大趋势,65%的应用开发将通过低代码完成 ZT
全球知名的咨询公司Gartner于近日发表了最新版的<低代码开发平台魔力象限>,并在报告中指出,到2024年65%的应用开发工作都将通过低代码的方式完成.Gartner长期关注软件开发领域 ...
- PMP--1.2 PMBOK指南组成部分
图1.2.5 PMBOK指南关键组成部分在项目中的相互关系说明:项目生命周期中包含项目阶段,项目阶段结束之后就是阶段关口: 而项目管理过程和项目管理过程组以及项目管理知识领域都是为了项目生命周期服 ...
- 10maven依赖继承、统一版本/编码
A > B > C A依赖于B,B依赖于C,如果A想间接依赖C,那么B和C之间的依赖范围必须是compile,不然A依赖不了C 但是有点麻烦,因为每次A想依赖于C都要确认B和C之间的 ...
- maven 3.6.3 安装及配置
1.下载 下载地址:http://maven.apache.org/download.cgi 2.配置环境变量 解压压缩包到磁盘. 注意:各种系统配置环境变量位置不一样,已windows10为例. 我 ...
- 软件分享大会之Bonny使用感想
近日大一期末临近,处在计算机大类专业的我也即将面临专业分流.在软件工程这个新的开始前,未来的系主任组织了一次软件分享会,通过大二.大三学生向大一的我们的作品展示,提前让我们了解自制软件如现流行软件的不 ...
- Exec msdb.dbo.sp_send_dbmail 参数详解(SQL Server 存储过程发邮件)
转载oriency755 发布于2012-12-04 11:34:45 阅读数 6870 收藏 sp_send_dbmail [ [ @profile_name = ] 'profile_name ...