Expanding Rods

http://poj.org/problem?id=1

 #include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
using namespace std; const double eps=1e-;
double n,c,l; int main()
{
while(scanf("%lf%lf%lf",&l,&n,&c)&&l!=-&&n!=-&&c!=-){
double s=(+n*c)*l;
double low=,high=0.5*l,mid;
while(high-low>eps)
{
mid=(high+low)/;
double r=(*mid*mid+l*l)/(*mid);
double ss=*r*asin(l/(*r));
if(ss<s)
low=mid;
else
high=mid;
}
printf("%.3lf\n",mid);
}
return ;
}
上一篇:MySQL最常用分组聚合函数


下一篇:MySQL学习之路(1):SQL脚本语言