| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
直接二分答案, 1e-4精度飘过1e-4精度飘过
#include <stdio.h>
#include <math.h>
double Low,High,Mid,Sita,R;
int main()
{
double L,T,C,L2;
while(scanf("%lf%lf%lf",&L,&T,&C)==3)
{
if(L<0&&T<0&&C<0) break;
if(L==0||T==0||C==0)
{
puts("0.000");
continue;
}
L2 = L + T*C*L;
Low = 0;
High = L/2;
while(High-Low > 1e-4)
{
Mid = (High + Low)/2;
R = Mid/2 + L*L/8/Mid;
Sita = acos(1-L*L/R/R/2);
if(Sita*R >= L2)
High = Mid;
else Low = Mid;
}
printf("%.3lf\n",Mid);
}
}
Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator