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:谁路过看一下我的程序,wa中。。。好多数据都行

Posted by frkstyc at 2005-07-28 15:29:16 on Problem 2508
In Reply To:谁路过看一下我的程序,wa中。。。好多数据都行 Posted by:fjnu_jxd_010 at 2005-07-28 15:27:54
> #include<iostream>
> #include<iomanip>
> #include<cmath>
> using namespace std;
> int main()
> {
> double  r, h, d1, a1,d2,a2,pi=3.1415926535898,R,w,ld,sha,dm,da,h1,slo,a;//
> 	while(cin>>r>>h>>d1>>a1>>d2>>a2)
> 	{//	if(fabs(a1-a2)==0||fabs(a1-a2)==360)
> //slo=fabs(d1-d2);
> //	else
> 	{
> 
> 	a1=a1/360.0*2.0*pi;
> 		a2=a2/360.0*2*pi;
> 		R=sqrt(r*r+h*h);
> 		a=fabs(a1-a2);
> 	
> 	//	else 
> 	//	{
> 			if(d1>d2)
> 			{	da=d1;dm=d2;}
> 
> 			else
> 			{da=d2;dm=d1;}
> 
> 	  
> 		if(a>pi)
> 			a=a-pi;
                           ~~~~~~~wrong!
> 		w=2.0*pi*r/R*a/(2*pi);
> 		sha=sin(w)*d1*d2;
> 		h1=sha/da;
> 		ld=sqrt(dm*dm-h1*h1);
> 		slo=sqrt(h1*h1+(da-ld)*(da-ld));
> 	}
> 		cout<<fixed<<setprecision(2)<<slo<<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