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可过,1e-3未试。

Posted by acpp16 at 2010-04-13 16:40:57 on Problem 1905
直接二分结果,精度很高,1e-4可过,1e-3未试。

核心代码:
bool can(double D)
{
	double R = (sqr(L)/4 + sqr(D)) / (2*D);
	double sita = asin(L/2 / R) * 2;
	double Len = 2 * sita * R * 0.5;
	if (cmp(Len - Length)<=0)
		return true;
	return false;
}

while (High-Low >1e-4)
{
	double Mid = (Low + High)/2;
	if (can(Mid))
		Low = Mid;
	else
		High = 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