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

哎,精度太怪异了.....

Posted by 00liuqing at 2008-12-01 19:11:05 on Problem 1905
#include<iostream>
#include<math.h>
using namespace std;
int main()
{
	double l,l1,d,u,h,c,t,ang,d_u;
	while(cin>>l>>t>>c)
	{
		if(l<0)
			break;
		if(fabs(l)<0.000000000001)
		{
			printf("0.000\n");
			continue;
		}
		l1=l+c*t*l;
		d=0;
		u=2.5;
		while(fabs(d-u)>0.000000000001){
			ang=(d+u)/2;
			d_u=sin(ang)/ang;
			if(l1*d_u<=l)    //此处<=就accept,<就wrong answer
				u=ang;
			else d=ang;
		}
		h=l*tan(ang/2)/2;
		printf("%.3lf\n",h);

	}
	return 0;
}

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