Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

直接二分答案, 1e-4精度飘过

Posted by porker2008 at 2011-08-05 17:38:16 on Problem 1905
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:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator