#include<iostream>
#include<cmath>
#include<string.h>
#include<algorithm>
using namespace std;
int inf=0x3f3f3f3f;
const int maxn=105;
int n,m;
int father[maxn];
struct MP
{
int u,v;
double w;
}mp[maxn];
struct P
{
int x,y;
}p[maxn];
bool cmp(const MP a,const MP c)
{
return a.w<c.w;
}
void init()
{
for(int x=1;x<=n;x++)
{
father[x]=x;
}
}
int Find(int x)
{
while(x!=father[x])
x=father[x];
return x;
}
void combine(int a,int c)
{
int temp=Find(a);
int temp1=Find(c);
if(temp!=temp1)
{
father[temp]=temp1;
}
}
double ccl(const P a,const P c)
{
return sqrt((c.x-a.x)*(c.x-a.x)+(c.y-a.y)*(c.y-a.y));
}
double kruskal()
{
sort(mp,mp+m,cmp);
init();
double ans=0;
for(int i=1;i<=m;i++)
{
MP e=mp[i];
if(Find(e.u)!=Find(e.v))
{combine(e.u,e.v);
ans+=mp[i].w;}
}
return ans;
}
int main()
{
int t;
cin>>t;
while(t--)
{
cin>>n;
m=n*(n-1)/2;
for(int i=1;i<=m;i++)
mp[i].w=inf;
for(int i=1;i<=n;i++)
{
cin>>p[i].x>>p[i].y;
}
int u,v;
double w;
int i=1;
for(int u=1;u<=n;u++)
for(int v=u;v<=n;v++)
{
w=ccl(p[u],p[v]);
if(w<10||w>1000)continue;
if(mp[i].w>w)
{
mp[i].u=u;
mp[i].v=v;
mp[i].w=w;
}
i++;
}
//for(int i=1;i<=m;i++)
//cout<<"?"<<mp[i].u<<"
"<<mp[i].v<<" "<<mp[i].w<<endl;
//以下为判断是否全部连接
int flag=true;
double tep=kruskal();for(int i=2;i<=n;i++)
if(Find(1)!=Find(i))flag=false;
if(flag)cout<<tep*100<<endl;
else cout<<"oh!"<<endl;
}
}
样例过了,但是超时,不知道为什么,暂且放下