Building a Space Station(bfs)】的更多相关文章

http://poj.org/problem?id=2031 题意:给出n个球的圆心坐标x,y,z, 半径r,若任意两球不相交,则在两球间建桥.问需建桥的最短距离是多少. 思路:建图,以两球间相差的距离为权值,然后求最小生成树. #include <stdio.h> #include <math.h> #include <string.h> <<; ; ; double sum,Map[maxn][maxn],dis[maxn]; int vis[maxn]…
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…
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…
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…
Building a Space Station Time Limit: 1000MS   Memory Limit: 30000K Total Submissions: 8572   Accepted: 4093 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…
Building a Space Station Time Limit: 1000MS   Memory Limit: 30000K Total Submissions: 7469   Accepted: 3620 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 POJ - 2031 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 ma…
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…
Building a Space Station Time Limit: 1000MS Memory Limit: 30000K Total Submissions: 5869 Accepted: 2910 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 ex…
Building a Space Station Time Limit: 1000MS   Memory Limit: 30000K Total Submissions: 6083   Accepted: 3024 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…
Time Limit: 1000MS   Memory Limit: 30000K Total Submissions: 3820   Accepted: 1950 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 com…
题目: 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 computer program to complete the task. The space station is made up with a number…
链接: http://poj.org/problem?id=2031 Time Limit: 1000MS   Memory Limit: 30000K Total Submissions: 6011   Accepted: 2989 Description You are a member of the space station engineering team, and are assigned a task in the construction process of the stati…
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 a number of units, called…
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 a number of units, called…
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 a number of units, called…
http://poj.org/problem?id=2031 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 computer program to complete the task.  The space stati…
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 computer program to complete the task.The space station is made up with a number of un…
http://poj.org/problem?id=2031 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 computer program to complete the task. The space statio…
Time Limit: 1000MS   Memory Limit: 30000K Total Submissions: 15664   Accepted: 6865 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 co…
题意: 就是给出三维坐标系上的一些球的球心坐标和其半径,搭建通路,使得他们能够相互连通.如果两个球有重叠的部分则算为已连通,无需再搭桥.求搭建通路的最小边长总和是多少. 思路: 先处理空间点之间的距离,要注意的是两个球面相交的情况,相交的话距离是0.两球面距离是球心距离减去两个球的半径(边权 = AB球面距离 = A球心到B球心的距离 – A球半径 – B球半径),相交时距离是算出来是负值,要改为0.其实就是求连接所有球最小生成树的过程. 代码: kruskal: #include <iostr…
题目传送门 题意:给出n个三维空间的球体,球体是以圆心坐标+半径来表示的,要求在球面上建桥使所有的球联通,求联通所建桥的最小长度. 分析:若两点距离大于两半径和的长度,那么距离就是两点距离 - 半径和,否则为0,Prim写错了,算法没有完全理解 /************************************************ * Author :Running_Time * Created Time :2015/10/25 12:00:48 * File Name :POJ_2…
这题目,用G++ WA,用C++ AC. 题目要求,现给出n个球,然后要使每两个球直接或者间接连通,可以在任意两球之间做管道(在表面),最后的要求是,如果使得都连通的话,管道最小长度是多少. 思路简单,就是求出来每两个球之间的距离,球心差减去两球的半径,注意如果这里是负的则处理为0.然后就是克鲁斯卡尔求最小生成树就可以了. #include <stdio.h> #include <stdlib.h> #include <math.h> #include <stri…
只是坐标变成三维得了,而且要减去两边的半径而已 题目 //最小生成树,只是变成三维的了 #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…
这个题要交c++, 因为prime的返回值错了,改了一会 题目:http://poj.org/problem?id=2031 题意:就是给出三维坐标系上的一些球的球心坐标和其半径,搭建通路,使得他们能够相互连通.如果两个球有重叠的部分则算为已连通,无需再搭桥.求搭建通路的最小费用(费用就是边权,就是两个球面之间的距离 思路:求球之间的距离, 距离小于半径 说明联通 , 距离为0. #include<iostream> #include<cstdio> #include<cst…
poj2031:http://poj.org/problem?id=2031 题意:就是给出三维坐标系上的一些球的球心坐标和其半径,搭建通路,使得他们能够相互连通.如果两个球有重叠的部分则算为已连通,无需再搭桥.求搭建通路的最小费用(费用就是边权,就是两个球面之间的距离). 题解:其实就是图论的最小生成树问题球心坐标和半径是用来求 两点之间的边权 的,求出边权后,把球看做点,用邻接矩阵存储这个无向图,再求最小生成树,非常简单的水题把球A和球B看做无向图图的两个结点,那么边权 = AB球面距离 =…
http://poj.org/problem?id=2031 #include<cstdio> #include<cstring> #include<cmath> #include<algorithm> using namespace std; ; <<; int cmp(double x) { ; ) ; ; } const double pi=acos(-1.0); inline double sqr(double x) { return x…
空间站是有一些球状的房间组成的,现在有一些房间但是没有相互连接,你需要设计一些走廊使他们都相通,当然,有些房间可能会有重合(很神奇的样子,重合距离是0),你需要设计出来最短的走廊使所有的点都连接. 分析:因为给的都是点的坐标,所以构图的时候会有一些麻烦,不过也仅此而已... ******************************************************************* #include<iostream> #include<cstring>…