|
|
back to boardWA#@21 help me! const n=2; var i,l:longint; q,w,e:array[1..n] of longint; a,b,c,p,h,r:real; Begin for i:=1 to 2 do read(q[i]); for i:=1 to 2 do read(w[i]); for i:=1 to 2 do read(e[i]); read(l); if q[1]-w[1]=0 then h:=abs(e[1]-w[1]) else h:=abs(e[2]-q[2]-(w[2]-q[2])*(e[1]-q[1])/(w[1]-q[1]))/sqrt(1+sqr((w[2]-q[2])/(w[1]-q[1]))); c:=sqrt(sqr(q[2]-w[2])+sqr(q[1]-w[1])); a:=sqrt(sqr(e[2]-w[2])+sqr(e[1]-w[1])); b:=sqrt(sqr(q[2]-e[2])+sqr(q[1]-e[1])); if a*a+b*b<c*c then h:=h else begin if a*a+c*c<b*b then h:=a; if b*b+c*c<a*a then h:=b; end; if h>l then h:=h-l else h:=0; writeln(h:5:2); if a>b then begin if a>l then r:=a-l else r:=0; end else begin if b>l then r:=b-l else r:=0; end; writeln(r:5:2); readln; readln; end. Edited by author 17.08.2007 02:59 |
|
|