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 ( ...
随机推荐
- UVa 129 Krypton Factor【回溯】
学习的紫书的回溯,理解起来还是好困难的说啊= = #include<iostream> #include<cstdio> #include<cstring> #in ...
- Hadoop实战课程
Hadoop生态系统配置Hadoop运行环境Hadoop系统架构HDFS分布式文件系统MapReduce分布式计算(MapReduce项目实战)使用脚本语言Pig(Pig项目实战)数据仓库工具Hive ...
- [转] 解析Qt资源文件使用
解析Qt资源文件使用 转自:http://mobile.51cto.com/symbian-270121.htm 本文详细的介绍了Qt文件的使用,和大部分GUI框架设计工具一样,Qt也引入了资源文件系 ...
- 一行JS代码,解决DedeCMS TAG标签错误输入符号问题
在维护内容的时候, Tag标签输入经常要来回切换输入法, 只能通过','号分隔. 中文用户, 输入法出来的经常是全角的, 经常弄错, 增加了检查的工作量, 现在只要一句JS代码, 就自动替换所有 ...
- Spark RDD操作(1)
https://www.zybuluo.com/jewes/note/35032 RDD是什么? RDD是Spark中的抽象数据结构类型,任何数据在Spark中都被表示为RDD.从编程的角度来看,RD ...
- Btn要记得对状态进行设置
self.catBtn = [UIButtonbuttonWithType:UIButtonTypeSystem]; self.catBtn.backgroundColor = [UIColorred ...
- 剑指offer-第二章排序之年龄排序
题目:对某个公司的人的年龄(0-99)进行排序,该公司的总人数为几万人.要求时间复杂度为O(n),可以辅助O(n)的空间. 思路:实现函数为void SortAge(int ages[],int le ...
- AJax学习一
1.Ajax的准备工作,就是要先准备好服务器环境. 这边可以有好几种方式,例如服务器工具: http://www.php100.com/html/plugin/ser/2013/0905/91.htm ...
- php 处理透明背景的图片时的问题
PHP图象处理之透明背景的gif和png图片的一些问题 1,直接读取有透明背景的PNG格式文件,然后直接输出,背景变成了黑色,gif则没有这种情况. 解决方法:使用 imagesavealpha ...
- 挺好看的CSS
<?php header("content-type:text/html;charset=utf-8"); echo "<style>h1{ color ...