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 elf788544 at 2005-08-19 23:03:27 on Problem 2507
In Reply To:为什么还是WA,我实在转不过来了. Posted by:Essence_me at 2005-07-30 10:35:27
> include <math.h>
> #define ABS(x) (((x)<0)?(-(x)):((x)))
> 
> void main()
> {
> 	float m1,m2,a,x,y,c;
> 	double h1,h2,c1;
> 	while(scanf("%f",&x)==1)
> 	{
> 		if(scanf("%f",&y)!=1)break;
> 		if(scanf("%f",&c)!=1)break;
> 		m1=0;
> 		m2=(x<y)?(x):(y);
> 		
> 		while(1)
> 		{
> 			if(ABS(m1-m2)<0.001)
> 			{
> 				a=m1;
> 				break;
> 			}
> 			a=(m2+m1)/2;
> 			h1=sqrt(x*x-a*a);
> 			h2=sqrt(y*y-a*a);
> 			c1=(h1*h2)/(h1+h2);
> 			if(c1==c)break;
> 				else if(c<c1)m1=a;
> 					else m2=a;
> 
> 		}
> 		printf("%.3f\n",a+0.005);
> 	}
> }
> 我给你加了一个条件就AC了!!!!

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