<?php
$dots = [];
for ($i=0; $i<=4; $i++) {
}
$minDisstance = INF;
for ($i=0; $i<count($dots)-1; $i++) { for ($j=$i+1; $j<count($dots); $j++) { $x0 = $dots[$i][0];
$x1 = $dots[$j][0];
$y0 = $dots[$i][1];
$y1 = $dots[$j][1];
$disstance = sqrt(pow($x0-$x1, 2) + pow($y0-$y1, 2));
if ($disstance < $minDisstance) {
$minDisstance = $disstance;
}
echo "($x0 $y0) : ($x1 $y1) - $disstance\n";
}
}
echo "минимальное расстояние между точками - " . $minDisstance;
//var_dump($ranges);
PD9waHAKZXJyb3JfcmVwb3J0aW5nKC0xKTsKCiRkb3RzID0gW107CmZvciAoJGk9MDsgJGk8PTQ7ICRpKyspIHsKCSRkb3RzW10gPSBbbXRfcmFuZCgwLDIwKSxtdF9yYW5kKDAsMjApXTsKfQoKJG1pbkRpc3N0YW5jZSA9IElORjsKCmZvciAoJGk9MDsgJGk8Y291bnQoJGRvdHMpLTE7ICRpKyspIHsKCWZvciAoJGo9JGkrMTsgJGo8Y291bnQoJGRvdHMpOyAkaisrKSB7CgkJJHgwID0gJGRvdHNbJGldWzBdOwoJCSR4MSA9ICRkb3RzWyRqXVswXTsKCQkkeTAgPSAkZG90c1skaV1bMV07CgkJJHkxID0gJGRvdHNbJGpdWzFdOwoJCSRkaXNzdGFuY2UgPSBzcXJ0KHBvdygkeDAtJHgxLCAyKSArIHBvdygkeTAtJHkxLCAyKSk7CgkJCgkJaWYgKCRkaXNzdGFuY2UgPCAkbWluRGlzc3RhbmNlKSB7CgkJCSRtaW5EaXNzdGFuY2UgPSAkZGlzc3RhbmNlOwoJCX0KCQkJCgkJZWNobyAiKCR4MCAkeTApIDogKCR4MSAkeTEpIC0gJGRpc3N0YW5jZVxuIjsKCX0KfQplY2hvICLQvNC40L3QuNC80LDQu9GM0L3QvtC1INGA0LDRgdGB0YLQvtGP0L3QuNC1INC80LXQttC00YMg0YLQvtGH0LrQsNC80LggLSAiIC4gJG1pbkRpc3N0YW5jZTsKLy92YXJfZHVtcCgkcmFuZ2VzKTs=