Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
Register

## 终于过了....试了一个上午的1e-5以前的数,就是没试1e-6哇........5555555555

Posted by mythology at 2007-08-04 10:56:19 on Problem 2507
In Reply To:谁能帮帮小弟啊------~~~~~~~~~~~~5555555555555555555WA了一个早上啊?..究竟要注意什么啊?... Posted by:mythology at 2007-08-04 10:32:26
```> #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: