/* Author: ACb0y Date: 2010-5-22 Result: AC Descripition: UVa 10034 Freckles(mst) */ #include <iostream> #include <cmath> using namespace std; double INF = 1 << 30; struct point { double x; double y; }; double d[110]; point ps[110]; int vis[110]; int n; double get_dis(int a, int b) { return sqrt((ps[a].x - ps[b].x) * (ps[a].x - ps[b].x) + (ps[a].y - ps[b].y) * (ps[a].y - ps[b].y)); } double mst() { int i, j; for (i = 0; i < n; i++) { d[i] = INF; } d[0] = 0; double ans = 0; memset(vis, 0, sizeof(vis)); for (i = 0; i < n; i++) { double min = INF; int pos; for (j = 0; j < n; j++) if (!vis[j]) { if (d[j] < min) { min = d[j]; pos = j; } } ans += min; vis[pos] = 1; for (j = 0; j < n; j++) if (!vis[j]) { double temp = get_dis(pos, j); if (temp < d[j]) { d[j] = temp; } } } return ans; } int main() { #ifndef ONLINE_JUDGE freopen("10034.txt", "r", stdin); #endif int k; cin >> k; while (k--) { cin >> n; for (int i = 0; i < n; i++) { cin >> ps[i].x >> ps[i].y; } printf("%.2lf/n", mst()); if (k != 0) { cout << endl; } } return 0; }