Код:
var d,a,b,c,x1,y1,x2,y2,x0,y0:real;
 
function min(a,b:real):real;
begin
if a>b then min:=b 
       else min:=a;
end;
       
begin

 readln(x0,y0);
 readln(x1,y1,x2,y2);

 a:=sqrt((x1-x0)*(x1-x0)+(y1-y0)*(y1-y0));
  b:=sqrt((x2-x0)*(x2-x0)+(y2-y0)*(y2-y0));
   c:=sqrt((x2-x1)*(x2-x1)+(y2-y1)*(y2-y1));

 if (c*c+b*b<a*a) or (c*c+a*a<b*b) 
  then d:=min(a,b)
   else d:=abs((y2-y1)*x0+(x1-x2)*y0+(y1*x2-x1*y2))/sqrt(a*a+b*b);
   
 writeln(d:2:1);
end.

Вот как-то так  :glasses: