HDU 2199
2013-05-01 22:51
363 查看
题目描述
题目:HDOJ 2199
分析
Y的值随着x的增加(0<x<100)单调递增,因此可以使用二分法解决该问题
注意"No solution!"的条件,可以通过设定两个阈值min和max来实现
源代码
题目:HDOJ 2199
分析
Y的值随着x的增加(0<x<100)单调递增,因此可以使用二分法解决该问题
注意"No solution!"的条件,可以通过设定两个阈值min和max来实现
源代码
#include <stdio.h> double getValue(double x); int main() { int T; double Y; double left, right, mid; scanf("%d", &T); double min = getValue(0); double max = getValue(100); while (T --) { scanf("%lf", &Y); if (Y < min || Y > max) { printf("No solution!\n"); continue; } left = 0; right = 100; while (right - left > 1e-7) { mid = (left + right) / 2; if (getValue(mid) >= Y) right = mid; else left = mid; } printf("%.4lf\n", (left + right) / 2); } return 0; } double getValue(double x) { return (8*x*x*x*x + 7*x*x*x + 2*x*x + 3*x + 6); }
相关文章推荐
- HDU 2199 Can you solve this equation?(简单二分)
- hdu 2199又是一道二分答案的题
- HDU 2199 Can you solve this equation?(二分)
- hdu 2199 Can you solve this equation?
- HDU 2199 Can you solve this equation(二分水题)
- hdu - 2199 - Can you solve this equation?(二分)
- hdu 2199 Can you solve this equation?
- HDU 2199 Can you solve this equation? 二分
- hdu 2199 二分查找
- HDU 2199 (13.08.07)
- hdu 2199 Can you solve this equation?
- HDU 2199(牛顿迭代法)/(二分)(高次方程求解)
- HDU:2199 Can you solve this equation?(二分)
- HDU-2199(二分搜索无限逼近)
- hdu2199 Can you solve this equation?(二分查找,多项式求解)
- hdu 2199 Can you solve this equation?(二分法求多项式解)
- HDU 2199 Can you solve this equation(二分水题)
- HDU 2199 Can you solve this equation? 二分求方程解
- HDU - 2199 Can you solve this equation? 二分
- hdu-2199-Can you solve this equation