Cod sursa(job #710298)

Utilizator lehman97Dimulescu David lehman97 Data 9 martie 2012 13:35:12
Problema Cele mai apropiate puncte din plan Scor 0
Compilator fpc Status done
Runda Arhiva educationala Marime 0.79 kb
type vec=record
x:longint;
y:longint;
end;
     vector=array[1..100]of vec;
var  v:vector;
     n,i:longint;
     r,max:real;


procedure sort(l,r:longint;var v:vector);
var i,j:longint;
    y:vec;
begin
for i:=l to r-1 do
for j:=i+1 to r do
if v[i].x>v[j].x then
  begin
  y:=v[i];
  v[i]:=v[j];
  v[j]:=y;
  end else
if (v[i].x=v[j].x)and(v[i].y>v[j].y) then
  begin
  y:=v[i];
  v[i]:=v[j];
  v[j]:=y;
  end;



end;





begin
assign(input,'cmap.in');reset(input);
assign(output,'cmap.out');rewrite(output);
read(n);
max:=maxlongint;
for i:=1 to n do
begin
read(v[i].x);
read(v[i].y);
end;
sort(1,n,v);
for i:=1 to n-1 do
begin
r:=sqrt(sqr(v[i].x-v[i+1].x)+sqr(v[i].y-v[i+1].y));
if r<max then max:=r;
end;
writeln(max:0:6);
close(output);
end.