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

Posted by wsxiaoys at 2006-09-08 13:37:31 on Problem 2507
```Program PKU2507;
const
zero=0.000000000001;
Var
x,y,c:extended;
f1,f2:text;
ans:extended;
Procedure Init;
Begin
c:=1/c;
End;
Function Get(left,right:extended):extended;
Var
t,k,a,b:extended;
Begin
k:=(left+right)/2;
a:=sqrt(sqr(x)-sqr(k));
b:=sqrt(sqr(y)-sqr(k));
t:=(a+b)/(a*b);
if abs(t-c)<zero then Get:=k
else if t-c<zero then Get:=Get(k,right)
else if t-c>zero then Get:=Get(left,k);
End;
Function Get_Min(a,b:extended):extended;
Begin
if a>b then Get_Min:=b
else get_min:=a;
End;
Procedure Print;
Begin
writeln(f2,ans:0:3);
End;
Begin
assign(f1,'input.in');
assign(f2,'output.out');
reset(f1);rewrite(f2);
Repeat
Init;
ans:=get(0,Get_Min(x,y));
Print;
Until EOF(f1);
close(f1);close(f2);
End.

Followed by: