var array of real r0 r1 r2 r12 real integer function dist x1 y1 x2 y2

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
var x,y:array [0..2] of real;
r0,r1,r2,r12,a,b,c,t:real;
i:integer;
function dist (x1,y1,x2,y2:real):real; {Расстояние между точками}
begin
dist:=sqrt(sqr(x2-x1)+sqr(y2-y1));
end;
begin
readln (x[0],y[0],x[1],y[1],x[2],y[2]);
r1:=dist(x[0],y[0],x[1],y[1]);
r2:=dist(x[0],y[0],x[2],y[2]);
r12:=dist(x[1],y[1],x[2],y[2]);
a:=y[2]-y[1]; b:=x[1]-x[2]; c:=-x[1]*(y[2]-y[1])+y[1]*(x[2]-x[1]);
t:=dist (a,b,0,0);
if c>0 then begin a:=-a; b:=-b; c:=-c; end;
r0:=(a*x[0]+b*y[0]+c)/t;
write (abs(r0):6:2);
end.