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 (Java/Others) Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 13468 Accepted Submission(s): 6006
Now please try your lucky.
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>
#include<algorithm>
#define N 100010 using namespace std; int main()
{
int t, y;
double low, high, mid, k, x1, x2;
scanf("%d", &t);
while(t--)
{
scanf("%d", &y);
low = ;
high = ;
x1 = * pow(, ) + * pow(, ) + * pow(, ) + * + ;
x2 = * pow(, ) + * pow(, ) + * pow(, ) + * + ;
if(x1 <= y && y <= x2)
{
while(high - low > 1e-)/*注意1e-7*/
{
mid = (low + high) / ;
k = * pow(mid, ) + * pow(mid, ) + * pow(mid, ) + * mid + ;
if(k > y)
high = mid - 1e-;
else if(k < y)
low = mid + 1e-;
}
printf("%.4f\n", 1.0 * (low + high) / );
}
else
printf("No solution!\n"); }
return ;
}
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?【二分查找】
解题思路:给出一个方程 8*x^4 + 7*x^3 + 2*x^2 + 3*x + 6 == Y,求方程的解. 首先判断方程是否有解,因为该函数在实数范围内是连续的,所以只需使y的值满足f(0)< ...
- 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/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 ( ...
随机推荐
- 听说noip2015有幻方
终于可以说一句:pascal大法好了 magic.pp是写好的算幻方哦…… 虽然这种水题大家都会,也没什么卵用……
- 移动WebApp开发框架(珍藏)
1.Jquery Mobilehttp://demos.jquerymobile.com/1.4.5/button-markup/http://andymatthews.net/code/jQuer ...
- Chrome 快捷键使用
窗口和标签页快捷方式 Ctrl+N 打开新窗口 按住 Ctrl 键,然后点击链接 在新标签页中打开链接 按住 Shift 键,然后点击链接 在新窗口中打开链接 Alt+F4 关闭当前窗口 Ctrl+ ...
- Sqlite数据库 找不到请求的 .Net Framework Data Provider。可能没有安装
解决方法 在web.config里面添加 <system.data> <DbProviderFactories> <remove invariant="Sy ...
- spring security的标签库
应用标签库:<%@ taglib prefix='security ' uri='http://www.springframework.org/security /tags' %> < ...
- Android RecyclerView使用详解(二)
在上一篇(RecyclerView使用详解(一))文章中简单的介绍了RecyclerView的基本用法,接下来要来讲讲RecyclerView的更多用法,要实现不同的功能效果,大部分都还是在于Recy ...
- unity, setting standard shader by script
http://forum.unity3d.com/threads/change-standard-shader-render-mode-in-runtime.318815/
- Javascript的匿名函数
一.什么是匿名函数?在Javascript定义一个函数一般有如下三种方式:函数关键字(function)语句:function fnMethodName(x){alert(x);}函数字面量(Func ...
- IIS6到7,web.config的配置
如果在IIS6中你的web.config中是以下配置: 这是在IIS6中我们习惯的经典模式的配置 < system.web> " " " " &q ...
- Cocos2d-x FlappyBird
HelloWorldScene.cpp #include "HelloWorldScene.h" USING_NS_CC; CCScene* HelloWorld::scene() ...