Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
呃。。。Wrong Answer....Program PKU2507; const zero=0.000000000001; Var x,y,c:extended; f1,f2:text; ans:extended; Procedure Init; Begin read(f1,x,y,c); 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: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator