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:我晕,我又遇到这种g++wrong,c++ 却ac的情况了

Posted by 2013014243 at 2014-08-12 13:40:27 on Problem 2546
In Reply To:我晕,我又遇到这种g++wrong,c++ 却ac的情况了 Posted by:TSERROF at 2012-08-16 16:15:42
> #include <cstdio>
> #include <cmath>
> #include <cstdlib>
> #define PI 3.1415926535897932384626433
> int main()
> {
> 	double x1,y1,r1,x2,y2,r2;
> 	while(scanf("%lf%lf%lf%lf%lf%lf",&x1,&y1,&r1,&x2,&y2,&r2)!=EOF)
> 	{
> 		double distance=sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2));
> 		if(r1+r2<distance)printf("0.000\n");
> 		else if(abs(r2-r1)>=distance)
> 		{
> 			if(r2>=r1)printf("%.3lf\n",PI*r1*r1);
> 			else printf("%.3lf\n",PI*r2*r2);
> 		}
> 		else
> 		{
> 			double angle1=2*acos((r1*r1+distance*distance-r2*r2)/2/r1/distance);
> 			double angle2=2*acos((r2*r2+distance*distance-r1*r1)/2/r2/distance);
> 			double ans=r1*r1*angle1/2+r2*r2*angle2/2-r1*r1*sin(angle1)/2-r2*r2*sin(angle2)/2;
> 			printf("%.3lf\n",ans);
> 
> 	}
> 	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