ural1753Bookshelf 三分
2014-09-15 20:50
381 查看
#include <iostream> #include <cstdio> #include <cmath> using namespace std; const double eps=1e-6; double h,H,L; double cal(double x){//已左底角为原点,向右为x轴,书的中心为书的H/2处 return H*x/(2*sqrt(x*x+h*h))-x; } int main(){ scanf("%lf%lf%lf",&h,&H,&L); double low=1e-5,high=sqrt(H*H-h*h); while(fabs(high-low)>eps){ double lmid=(low*2+high)/3; double rmid=(low+high*2)/3; if(cal(lmid)>cal(rmid)) high=rmid; else low=lmid; } printf("%.6f\n",cal(low)); return 0; }
相关文章推荐
- URAL 1753 Bookshelf (三分答案)
- ural1753_三分
- URAL 1874 Football Goal 均值不等式&三分
- URAL 1988 - Planet Ocean Landing【几何&三分答案】
- 计算几何 ural 1753
- hdu 1753 大明A+B
- URAL 1025
- URAL 1715. Another Ball Killer (大模拟)
- URAL 1942 Attack at the Orbit
- ZOJ 3203 三分
- CVS (URAL 1992 可持久化的链表)
- HDU - 1753 - 大明A+B(高精度)
- URAL 2048 History 蔡勒公式
- ural 1932 The Secret of Identifier (容斥原理)
- URAL-1225 Flags
- hdu 1753 Java 高精度处理 大明A+B
- ural 1280. Topological Sorting
- POJ 1753 Flip Game(枚举)
- HDU 5144 NPY and shot(三分角度)
- HDU 4355——Party All the Time——————【三分求最小和】