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 ( ...
随机推荐
- UVa OJ 197 - Cube (立方体)
Time limit: 30.000 seconds限时30.000秒 Problem问题 There was once a 3 by 3 by 3 cube built of 27 smaller ...
- chrome 阻止跨域操作的解决方法 --disable-web-security
做chrome插件时,遇到https页面上请求htttp页面资源时被blocked的问题,初苦寻解决方法未果,最后找到: 给chrome加上 --disable-web-security 参数
- How to Write and Publish a Scientific Paper: 7th Edition(科技论文写作与发表教程)(11.04更新)
How to Write and Publish a Scientific Paper: 7th Edition(科技论文写作与发表教程)(11.04更新) 重要通知: 最近开题报告已差不多告一段落, ...
- 一步一步教你如何在linux下配置apache+tomcat(转)
一步一步教你如何在linux下配置apache+tomcat 一.安装前准备. 1. 所有组件都安装到/usr/local/e789目录下 2. 解压缩命令:tar —vxzf 文件名(. ...
- C++构造函数详解及显式调用构造函数
来源:http://www.cnblogs.com/xkfz007/archive/2012/05/11/2496447.html c++类的构造函数详解 ...
- Linux常用命令 查看进程信息时 copy的-----温故而知新
1.查进程 ps命令查找与进程相关的PID号: ps a 显示现行终端机下的所有程序,包括其他用户的程序. ps -A 显示所有程序. ps c 列出程序时,显示每个程序真正的 ...
- Java主流日志工具库
在项目开发中,为了跟踪代码的运行情况,常常要使用日志来记录信息.在Java世界,有很多的日志工具库来实现日志功能,避免了我们重复造轮子.我们先来逐一了解一下主流日志工具. 1.java.util.lo ...
- Run UliPad 4.1 Under Windows 7 64bit and wxPython 3.0.2
Abstract: UliPad that is developed by limodou is an excellent code editor. It works well with wxPyth ...
- Linux下的网络管理工具—OpenNMS
导读 OpenNMS的是一个运营商级别的,高度集成的,开放源码的平台,用于构建网络监控解决方案.OpenNMS有两个发行版:Meridian and Horizon.使用Meridian是可取的,对企 ...
- [BZOJ2303][Apio2011]方格染色
[BZOJ2303][Apio2011]方格染色 试题描述 Sam和他的妹妹Sara有一个包含n × m个方格的 表格.她们想要将其的每个方格都染成红色或蓝色. 出于个人喜好,他们想要表格中每个2 × ...