2020-11-05 06:59:22 +00:00
|
|
|
#include <bits/stdc++.h>
|
|
|
|
|
|
|
|
using namespace std;
|
|
|
|
|
|
|
|
struct point {
|
|
|
|
long long x, y;
|
|
|
|
};
|
|
|
|
|
2021-11-19 09:01:13 +00:00
|
|
|
int n, m;
|
|
|
|
bool v[5005];
|
2020-11-05 06:59:22 +00:00
|
|
|
long long d[5005];
|
2021-11-19 09:01:13 +00:00
|
|
|
point city[5005];
|
2020-11-05 06:59:22 +00:00
|
|
|
|
|
|
|
void prim() {
|
|
|
|
memset(d, 0x3f, sizeof(d));
|
|
|
|
memset(v, 0x00, sizeof(v));
|
|
|
|
d[1] = 0;
|
|
|
|
for (int i = 1; i <= n - 1; i++) {
|
|
|
|
int x = 0;
|
|
|
|
for (int j = 1; j <= n; j++) {
|
|
|
|
if (!v[j] && (x == 0 || d[j] < d[x])) {
|
|
|
|
x = j;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
v[x] = 1;
|
|
|
|
for (int y = 1; y <= n; y++) {
|
|
|
|
if (!v[y]) {
|
|
|
|
d[y] = min(d[y], (city[x].x - city[y].x) * (city[x].x - city[y].x) + (city[x].y - city[y].y) * (city[x].y - city[y].y));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
int main() {
|
|
|
|
cin >> n;
|
|
|
|
for (int i = 1; i <= n; i++) {
|
|
|
|
cin >> city[i].x >> city[i].y;
|
|
|
|
}
|
|
|
|
prim();
|
|
|
|
double ans = 0.00;
|
|
|
|
for (int i = 1; i <= n; i++) {
|
|
|
|
ans += sqrt((double)(d[i]));
|
|
|
|
}
|
|
|
|
cout << fixed << setprecision(2) << ans << endl;
|
|
|
|
return 0;
|
|
|
|
}
|