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

Re:你这种做法的精度不是特别高,你试试第三组数据,它的结果是7.67,和答案不一样

Posted by tcxgsy at 2005-10-06 07:28:53 on Problem 2508
In Reply To:更简单的程序, 呵呵 Posted by:ericsummer at 2005-08-05 18:50:29
> #include <iostream.h>
> #include <math.h>
> #include <iomanip.h>
> 
> 
> double min(double x ,double y)
> {
> 	return x<y?x : y ;
> }
> 
> int main()
> {
> 
> 	double r , h , d1 , a1 , d2 , a2 ,x ,d;
> 
> 	double pi = 2.0* asin(1);
> 
> 	while(cin >> r >> h >> d1 >> a1 >> d2 >> a2) 
> 	{
> 
> 	x = r*fabs(a1 - a2)/sqrt( r*r + h*h) * pi/180.0;
> 
> 	x = min(x , 2*pi*r/sqrt( r*r + h*h) -x);
> 
> 	d = sqrt( d1*d1+ d2*d2 - 2*d1*d2*cos(x));
> 
> 	
> 	
> 
> 	cout<< fixed << setpricision(2) << endl;
> 
> 	}
> 
> 	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