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 ( ...
随机推荐
- NetBeans快捷键的使用
.Ctrl-Tab:在打开的文件之间切换: .Ctrl-N:在当前打开的项目里新建文件: .Ctrl-F:当前文件查找匹配的字符(支持正则): .Ctrl-H:当前文件查找.替换匹配的字符(支持正则, ...
- 批处理:echo的用法
批处理:echo的用法 若要用 echo 命令显示一条命令,可用下述语法: echo [message] 参数 ON|OFF 指定是否允许命令的回显.若要显示当前的 ECHO 的设置,可使用不带 ...
- js 对象方法、类方法、原型方法的区别;私有属性、公有属性、公有静态属性的区别
<html> <head> <meta http-equiv="Content-Type" content="text/html; char ...
- 【原创】ui.router源码解析
Angular系列文章之angular路由 路由(route),几乎所有的MVC(VM)框架都应该具有的特性,因为它是前端构建单页面应用(SPA)必不可少的组成部分. 那么,对于angular而言,它 ...
- 构建seajs业务模块之grunt VS spm build
在最开始,我并不知道grunt可以构建CMD模块.(以下spm指代spm build) 当时正困惑于如何用spm方便的构建业务模块,后来看到@twinstony (感谢@twinstony的分享)使用 ...
- Android EditText的设置
1.输入法Enter键图标的设置: 软件盘的界面替换只有一个属性android:imeOptions,这个属性的可以取的值有normal,actionUnspecified,actionNone,ac ...
- gcc编译C++程序
gcc动态编译和静态编译方法 一.单个源.cpp文件生成可执行程序下面是一个保存在文件 helloworld.cpp 中一个简单的 C++ 程序的代码: /* helloworld.cpp */ #i ...
- 【OpenStack】OpenStack系列2之KeyStone详解
源码下载.依赖安装 参考:http://www.oschina.net/question/565065_66271 https://github.com/yongluo2013/osf-opensta ...
- 《ASP.NET1200例》在DataList里编辑和删除数据
学习内容:如何创建一个支持编辑和删除数据的DataList.增加编辑和删除功能需要在DataList的ItemTemplate和EditItemTemplate里增加合适的控件,创建对应的事件处理,读 ...
- Largest Divisible Subset
Given a set of distinct positive integers, find the largest subset such that every pair (Si, Sj) of ...