## Sample Input

``````2
2
10 10
20 20
3
1 1
2 2
1000 1000
``````

## Sample Output

``````1414.2
oh!
``````

8600

## Source

2008浙大研究生复试热身赛（2）——全真模拟

## Code

``````#include <bits/stdc++.h>
using namespace std;
typedef double db;
const int N = 110;
const db inf = 1e18;
typedef pair<db, int> P;
int n, m;

struct Point {
db x, y;
};

struct Edge {
int to;
db w;
Edge(int to, db w): to(to), w(w) {}
};
Point p[N];
vector<Edge> G[N];
db d[N];
int v[N];

void init() {
for(int i = 0; i < N; ++i) {
G[i].clear();
}
}

void add(int x, int y, db z) {
G[x].push_back(Edge(y, z));
}

db prim(int s) {
priority_queue<P, vector<P>, greater<P>> q;
for(int i = 0; i <= n; ++i) {
d[i] = inf;
}
memset(v, 0, sizeof(v));
db ans = 0;
d[s] = 0;
q.push(P(0, s));
while(q.size()) {
P p = q.top(); q.pop();
int x = p.second;
if(v[x]) continue;
v[x] = 1;
ans += d[x];
for(int i = 0; i < G[x].size(); ++i) {
Edge e = G[x][i];
if (d[e.to] > e.w && !v[e.to]) {
d[e.to] = e.w;
q.push(P(d[e.to], e.to));
}
}
}
return ans;
}

db dis(Point a, Point b) {
return sqrt(pow(a.x - b.x, 2) + pow(a.y - b.y, 2));
}

int main() {
int T;
scanf("%d", &T);
while(T--) {
init();
scanf("%d", &n);
for(int i = 1; i <= n; ++i) {
scanf("%lf%lf", &p[i].x, &p[i].y);
}
for(int i = 1; i <= n; ++i) {
for(int j = i + 1; j <= n; ++j) {
db tmp = dis(p[i], p[j]);
if(tmp >= 10 && tmp <= 1000) {
}
}
}
db ans = prim(1) * 100;
if(ans == 0) printf("oh!\n");
else printf("%.1lf\n", ans);
}
return 0;
}
``````