hdu 2199: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): 7493 Accepted Submission(s): 3484
Now please try your lucky.
#include <iostream>
#include <cmath>
#include <iomanip>
using namespace std; double cal(double x)
{
return *pow(x,) + *pow(x,) + *pow(x,) + *x + ;
}
double GetAns(double y)
{
double a=,b=;
while(b-a>1e-){
double mid=(a+b)/;
cal(mid)<y?a=mid:b=mid;
}
return (a+b)/;
}
int main()
{
int T;
cin>>T;
while(T--){
double y;
cin>>y;
if(cal()<=y && y<=cal()){
cout<<setiosflags(ios::fixed)<<setprecision();
cout<<GetAns(y)<<endl;
}
else
cout<<"No solution!"<<endl;
}
return ;
}
Freecode : www.cnblogs.com/yym2013
hdu 2199:Can you solve this equation?(二分搜索)的更多相关文章
- 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?(二分精度)
HDU 2199 Can you solve this equation? Now,given the equation 8*x^4 + 7*x^3 + 2*x^2 + 3*x + 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 ...
- 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 ...
- 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 ( ...
- hdu 2199 Can you solve this equation? 二分
Can you solve this equation? Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K ( ...
随机推荐
- js中对象概念的声明
- MongoDB之bson的介绍
MongoDB之bson的介绍 1. 什么是bson BSON是一种类json的一种二进制形式的存储格式,简称Binary JSON,它和JSON一样,支持内嵌的文档对象和数组对象,但是BSON有JS ...
- 关于Java单例
参考资料:http://blog.csdn.net/haoel/article/details/4028232 public class SingletonTest implements Runnab ...
- Unity Shader Billboard
记录来源于ShaderLab开发实战详解 Shader "Tut/Project/Billboard_1" { Properties { _MainTex ("Base ...
- Jquery 鼠标事件解析
1 mouseover与mousemove的区别: mouseover是当鼠标移动到对象时产生,只产生一次,这时如果继续在对象上移动,不会再产生mouseover事件,而是mousemove事件,mo ...
- Homebrew安装
1. 安装Command Line Tools 终端输入 xcode-select --install 回车,若下载慢,可搜索Command line Tools的pkg文件,自行安装. 或者直接安装 ...
- JS设置cookie,删除cookie
js设置cookie有很多种方法. 第一种:(这个是w3c官网的代码) <script> //设置cookie function setCookie(cname, cvalue, exda ...
- linux挂载硬盘失败,报错!
剛把我的一顆硬碟 ( NTFS ) 接到 Ubuntu 桌機上. 然後要 mount 的時候,出現了下面的訊息: DBus error org.gtk.Private.RemoteVolumeMon ...
- [整理]Ajax Post请求下的Form Data和Request Payload
Ajax Post请求下的Form Data和Request Payload 通常情况下,我们通过Post提交表单,以键值对的形式存储在请求体中.此时的reqeuest headers会有Conten ...
- matlab之waitbar() delete() close()
matlab之waitbar() delete() close() 三者之间的关系: 在显示某个程序的进度时,用waitbar函数显示进度条,当程序进行完毕时,用close 或 delete函数关闭此 ...