poj 1905 Expanding Rods 二分解方程

题意:

中已知L,S解h。

分析:

两个方程两个未知数,,理论是可解的。解起来有困难,可用二分的方法。

代码:

#include <iostream>#include <cmath>using namespace std;int main(){double l,n,c,s,r;while(scanf("%lf%lf%lf",&l,&n,&c)==3){if(l<0) break;double mid,low=0.0,high=l/2;s=(1+n*c)*l;while(high-low>1e-5){mid=(low+high)/2;r=(4*mid*mid+l*l)/(8*mid);if(2*r*asin(l/(2*r))<s)low=mid;elsehigh=mid;}printf("%.3lf\n",low);}return 0;}

飞机一阵抖动,我终于说出了最后一句再见。

poj 1905 Expanding Rods 二分解方程

相关文章:

你感兴趣的文章:

标签云: