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): 22742 Accepted Submission(s): 9865
Now please try your lucky.
100
-4
No solution!
二分求解
#include<stdio.h>
const double eps = 1e-8;//精度大胆设高些 double cal(double x,double y)
{
double m;
m = 8 * x*x*x*x + 7 * x*x*x + 2 * x*x + 3 * x + 6 - y;
return m;
} double bsearch(double y)
{
double left = 0, right = 100;
double mid;
while (right - left > eps)
{
mid = (left + right) / 2;
if (cal(mid, y)>0)
{
right = mid;
}
else
{
left = mid;
}
}
return mid;
} int main()
{
int T;
scanf("%d", &T);
double M,n;
while (T--)
{
scanf("%lf", &M);
if (M < 6 || M>807020306)//注意上下界
{
printf("No solution!\n");
}
else
{
n=bsearch(M);
printf("%.4lf\n", n);
}
}
return 0;
}
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? 二分
Can you solve this equation? Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K ( ...
- 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?【二分查找】
解题思路:给出一个方程 8*x^4 + 7*x^3 + 2*x^2 + 3*x + 6 == Y,求方程的解. 首先判断方程是否有解,因为该函数在实数范围内是连续的,所以只需使y的值满足f(0)< ...
- hdu 2199 Can you solve this equation?(二分搜索)
Can you solve this equation? Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K ( ...
随机推荐
- 让网页的title动起来
<!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <title&g ...
- xgraph和gnuplot初体验
今天分别体验了一下xgraph和gnuplot. xgraph是ns2自带的画图工具,使用很简单.它的标准的数据文件是ascii文本文件,每一行两个数据,以空格隔开,这样就有了两列数据.把这样的文 ...
- Bzoj3352 [ioi2009]旅行商
Time Limit: 20 Sec Memory Limit: 128 MBSubmit: 89 Solved: 36 Description 旅行商认定如何优化旅行路线是一个非常棘手的计算问题 ...
- Count 1 in Binary
Count how many 1 in binary representation of a 32-bit integer. Example Given 32, return 1 Given 5, r ...
- 【前端开发】localStorage的用法
localStorage.setItem("name","value") //存储name的值 var type = localStorage.getItem ...
- R语言以及RStdio的安装
R语言: 首先从官网上下载R安装包, 提供了Linux, (Mac) OS X, Windows的安装包相关下载链接. RStdio: RStdio(官网)是R言语非常实用的IDE, 是一个免费的软件 ...
- matlab随笔
主要是记录一些函数.(博客园的一些操作实在是太不方便了) cat函数:http://blog.sina.com.cn/s/blog_6b7dfd9d0100mnz7.html 联结两个数组 magic ...
- 一篇文章读懂开源web引擎Crosswalk-《转载》
前言 Web技术的优势早已被广大应用开发者熟知,比如可与云服务轻松集成,基于响应式UI设计的精美布局,高度的开放性,跨平台能力, 高效的分发与部署等等.伴随着移动互联网的快速发展与HTML5技术的逐步 ...
- Codeforces 798C - Mike and gcd problem(贪心+数论)
题目链接:http://codeforces.com/problemset/problem/798/C 题意:给你n个数,a1,a2,....an.要使得gcd(a1,a2,....an)>1, ...
- Java---容器基础总结
Java提供了大量持有对象的方式: (1) 数组将数字与对象联系起来. 它保存类型明确的对象,查询对象时,不需要对结果做类型转换.它可以是多维的, 可以保存基本类型的数据. 但是,数组一旦生成,其容量 ...