POJ 1905 Expanding Rods 解题报告(二分)
2013-08-07 13:37
561 查看
题目大意:求热胀后的弧的高度。
解题报告:二分很容易想,数学公式感觉才是难点。其实我一直很怀疑下面的代码的精度问题。当长度改变非常小时,r趋于无穷大,这时精度一定会有影响的。不多代码过了,偶没话说…………
解题报告:二分很容易想,数学公式感觉才是难点。其实我一直很怀疑下面的代码的精度问题。当长度改变非常小时,r趋于无穷大,这时精度一定会有影响的。不多代码过了,偶没话说…………
#include <cstdio> #include <cstring> #include <cmath> using namespace std; const double eps=1e-5; int main() { double L,h,c; double s; while(scanf("%lf%lf%lf",&L,&h,&c)) { if(L<0 && h<0 && c<0) break; s=L*(1+h*c); L/=2; double l=0; double r=L; while(r-l>eps) { double mid=(l+r)/2; double rr=(L*L+mid*mid)/(2*mid); if(2*rr*asin(L/rr)<s) l=mid; else r=mid; } printf("%.3lf\n",l); } }
相关文章推荐
- POJ-1905 Expanding Rods 解题报告(二分) 金属材料的膨胀
- pku 1905 二分 Expanding Rods 解题报告
- POJ-1905 Expanding Rods 解题报告
- POJ-1905 Expanding Rods 解题报告
- POJ 1905 Expanding Rods(二分)
- poj--1905 Expanding Rods(二分)
- Expanding Rods(二分POJ1905)
- POJ 1905 Expanding Rods 二分答案几何
- POJ 1631 Bridging signals 解题报告(附详细分析)最长上升子序列的dp+二分
- poj 1905 Expanding Rods---二分
- POJ 2976 Dropping tests 解题报告(二分)
- POJ 3258 River Hopscotch 解题报告(二分)
- poj 1905 Expanding Rods(二分)
- POJ 1905 Expanding Rods(二分)
- POJ 题目1905 Expanding Rods(二分,数学几何)
- POJ 2922 Honeymoon Hike 解题报告(二分+深搜)
- POJ1905-Expanding Rods-二分答案
- 【解题报告】 POJ 2318 TOYS -- 判断点在某个梯形内 叉积 + 二分
- poj 1905 Expanding Rods(木杆的膨胀)【数学计算+二分枚举】
- poj 1905 Expanding Rods(二分)