看很多ds都用状压dp,但本人是个蒟蒻不会
//dfs + 回溯 = ?
#include<bits/stdc++.h>
using namespace std;
struct node{//x、y结构体
double x, y;
}a[17];
int n;
double ans = 0x3f3f3f3f;
bool v[17];//标记数组
double Euclid_distance(int xx, int yy){//欧几里得距离公式
return sqrt((a[xx].x - a[yy].x) * (a[xx].x - a[yy].x) + (a[xx].y - a[yy].y) * (a[xx].y - a[yy].y));
}
void dfs(int xx, int de, double d){//回溯搜索(dfs)
if(d >= ans)return;//边界
if(de == n){
ans = min(d, ans);//更改最小值 & 边界
return;
}
for(int i = 1;i <= n;i++){//开始搜索
if(i == xx)continue;//同样是边界
if(!v[i]){//未标记
v[i] = 1;//标记
dfs(i, de+1, d + Euclid_distance(xx, i));//搜索
v[i] = 0;//回溯
}
}
return;
}
int main(){
cin >> n;
for(int i = 1;i <= n;i++)cin >> a[i].x >> a[i].y;
dfs(0, 0, 0.0);//全是0!!!!
printf("%.2lf", ans);//输出
return 0;
}