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

谁能帮帮小弟啊------~~~~~~~~~~~~5555555555555555555WA了一个早上啊?..究竟要注意什么啊?...

Posted by mythology at 2007-08-04 10:32:26 on Problem 2507
#include <stdio.h>
#include <math.h>

#define  M 1e-5

int   main ()
{
    double  x,y,c,t;

label:while(scanf("%lf%lf%lf",&x,&y,&c)==3)
    {
       double  mid,low,high,sum;
       if(x<y)
           t=x,x=y,y=t;
       if(c>=y)
			goto  label;
       low=0,high=y;
	   do
	   {
            mid=(low+high)/2;
            sum=c/sqrt(y*y-mid*mid)+c/sqrt(x*x-mid*mid);

            if(sum>1)
                high=mid;
            else  if(sum<1)
                low=mid;
            else
                goto  lza;
        }while(fabs(sum-1)>M && low+M<high);

lza:    printf("%.3lf\n",mid);
    }
}


谢谢了哈....

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