这个题要交c++, 因为prime的返回值错了,改了一会 题目:http://poj.org/problem?id=2031 题意:就是给出三维坐标系上的一些球的球心坐标和其半径,搭建通路,使得他们能够相互连通.如果两个球有重叠的部分则算为已连通,无需再搭桥.求搭建通路的最小费用(费用就是边权,就是两个球面之间的距离 思路:求球之间的距离, 距离小于半径 说明联通 , 距离为0. #include<iostream> #include<cstdio> #include<cst…
Building a Space Station 题目链接: http://acm.hust.edu.cn/vjudge/contest/124434#problem/C Description You are a member of the space station engineering team, and are assigned a task in the construction process of the station. You are expected to write a…
题目链接 http://poj.org/problem?id=2031 题意 给出N个球形的 个体 如果 两个个体 相互接触 或者 包含 那么 这两个个体之间就能够互相通达 现在给出若干个这样的个体 要求 从一个个体 可以到达任意一个另外的个体 如果两个个体之间 本来是不能够相互通达的 那么可以在这两个个体之间 建一座桥梁 现在要求 满足 从任意一个个体就可以到达任意一个另外的个体 需要建设桥梁的最少花费 思路 因为两个球体之间,如果 两个球心的距离 <= 两个球体的半径之和 那么这两个球体 就…
http://poj.org/problem?id=2031 题意 给出三维坐标系下的n个球体,求把它们联通的最小代价. 分析 最小生成树加上一点计算几何.建图,若两球体原本有接触,则边权为0:否则边权为它们球心的距离-两者半径之和.这样来跑Prim就ok了.注意精度. #include<iostream> #include<cmath> #include<cstring> #include<queue> #include<vector> #in…
只是坐标变成三维得了,而且要减去两边的半径而已 题目 //最小生成树,只是变成三维的了 #define _CRT_SECURE_NO_WARNINGS #include<stdlib.h> #include<stdio.h> #include<iostream> #include<string.h> #include<algorithm> #include<math.h> using namespace std; #define in…
Building a Space Station Time Limit: 1000MS   Memory Limit: 30000K Total Submissions: 5699   Accepted: 2855 Description You are a member of the space station engineering team, and are assigned a task in the construction process of the station. You ar…
链接: http://poj.org/problem?id=2031 http://acm.hust.edu.cn/vjudge/contest/view.action?cid=22013#problem/A Building a Space Station Time Limit: 1000MS   Memory Limit: 30000K Total Submissions: 3578   Accepted: 1830 Description You are a member of the s…
Building a Space Station You are a member of the space station engineering team, and are assigned a task in the construction process of the station. You are expected to write a computer program to complete the task. The space station is made up with…
3维空间中的最小生成树....好久没碰关于图的东西了.....              Building a Space Station Time Limit: 1000MS   Memory Limit: 30000K Total Submissions: 3804   Accepted: 1940 Description You are a member of the space station engineering team, and are assigned a task in th…
Building a Space Station Time Limit: 1000MS   Memory Limit: 30000K Total Submissions: 5173   Accepted: 2614 Description You are a member of the space station engineering team, and are assigned a task in the construction process of the station. You ar…