<?php
//Дан набор из N точек на плоскости (для простоты можно считать, что у всех точек целочисленные координаты).
//Найдите минимальное расстояние между двумя точками из этого набора.
function findMinLength
(array $points) {
foreach ($points as $point) {
foreach ($points as $point2) {
if ($point != $point2) {
$distance = abs($point - $point2); $min = $distance;
} elseif ($distance < $min) {
$min = $distance;
}
}
}
}
return $min;
}
PD9waHAKLy/QlNCw0L0g0L3QsNCx0L7RgCDQuNC3IE4g0YLQvtGH0LXQuiDQvdCwINC/0LvQvtGB0LrQvtGB0YLQuCAo0LTQu9GPINC/0YDQvtGB0YLQvtGC0Ysg0LzQvtC20L3QviDRgdGH0LjRgtCw0YLRjCwg0YfRgtC+INGDINCy0YHQtdGFINGC0L7Rh9C10Log0YbQtdC70L7Rh9C40YHQu9C10L3QvdGL0LUg0LrQvtC+0YDQtNC40L3QsNGC0YspLgovL9Cd0LDQudC00LjRgtC1INC80LjQvdC40LzQsNC70YzQvdC+0LUg0YDQsNGB0YHRgtC+0Y/QvdC40LUg0LzQtdC20LTRgyDQtNCy0YPQvNGPINGC0L7Rh9C60LDQvNC4INC40Lcg0Y3RgtC+0LPQviDQvdCw0LHQvtGA0LAuCiRwb2ludHMgPSBhcnJheSgxMCk7CmZ1bmN0aW9uIGZpbmRNaW5MZW5ndGgoYXJyYXkgJHBvaW50cykKewogICAgZm9yZWFjaCAoJHBvaW50cyBhcyAkcG9pbnQpIHsKICAgICAgICBmb3JlYWNoICgkcG9pbnRzIGFzICRwb2ludDIpIHsKICAgICAgICAgICAgaWYgKCRwb2ludCAhPSAkcG9pbnQyKSB7CiAgICAgICAgICAgICAgICAkZGlzdGFuY2UgPSBhYnMoJHBvaW50IC0gJHBvaW50Mik7CiAgICAgICAgICAgICAgICBpZiAoIWlzc2V0KCRtaW4pKSB7CiAgICAgICAgICAgICAgICAgICAgJG1pbiA9ICRkaXN0YW5jZTsKICAgICAgICAgICAgICAgIH0gZWxzZWlmICgkZGlzdGFuY2UgPCAkbWluKSB7CiAgICAgICAgICAgICAgICAgICAgJG1pbiA9ICRkaXN0YW5jZTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQogICAgICAgIH0KICAgIH0KICAgIHJldHVybiAkbWluOwp9CnByaW50X3IoZmluZE1pbkxlbmd0aCgkcG9pbnRzKSk7