#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
using namespace std;
long long n,x,y,a[5005][2],w[5005];
double s=0,minni[5005];
double dis(int a,int b,int c,int d)
{
return (double)sqrt((c-a)*(c-a)+(d-b)*(d-b));
}
int main()
{
int m;
cin>>n;
for(int i=1;i<=n;i++)
{
cin>>x>>y;
a[i][0]=x,a[i][1]=y;
}
for(int i=1;i<=n;i++)
minni[i]=0x7fffffff;
minni[1]=0;
for(int i=1;i<=n;i++)
{
double minn=0x7fffffff;
for(int j=1;j<=n;j++)
if(minni[j]<minn&&w[j]==0)
minn=minni[j],m=j;
w[m]=1;
s+=minn;
for(int k=1;k<=n;k++)
{
if(w[k]==0&&dis(a[m][0],a[m][1],a[k][0],a[k][1])<minni[k])
minni[k]=dis(a[m][0],a[m][1],a[k][0],a[k][1]);
}
}
printf("%.2lf",s);
return 0;
}
一脸懵逼调了1个小时。。。