poj 2031】的更多相关文章

Building a Space Station Time Limit: 1000MS Memory Limit: 30000K Total Submissions: 4400 Accepted: 2255 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 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…
这个题要交c++, 因为prime的返回值错了,改了一会 题目:http://poj.org/problem?id=2031 题意:就是给出三维坐标系上的一些球的球心坐标和其半径,搭建通路,使得他们能够相互连通.如果两个球有重叠的部分则算为已连通,无需再搭桥.求搭建通路的最小费用(费用就是边权,就是两个球面之间的距离 思路:求球之间的距离, 距离小于半径 说明联通 , 距离为0. #include<iostream> #include<cstdio> #include<cst…
http://poj.org/problem?id=2031 题意 给出三维坐标系下的n个球体,求把它们联通的最小代价. 分析 最小生成树加上一点计算几何.建图,若两球体原本有接触,则边权为0:否则边权为它们球心的距离-两者半径之和.这样来跑Prim就ok了.注意精度. #include<iostream> #include<cmath> #include<cstring> #include<queue> #include<vector> #in…
链接: 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…
链接: 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…
题目链接 http://poj.org/problem?id=2031 题意 给出N个球形的 个体 如果 两个个体 相互接触 或者 包含 那么 这两个个体之间就能够互相通达 现在给出若干个这样的个体 要求 从一个个体 可以到达任意一个另外的个体 如果两个个体之间 本来是不能够相互通达的 那么可以在这两个个体之间 建一座桥梁 现在要求 满足 从任意一个个体就可以到达任意一个另外的个体 需要建设桥梁的最少花费 思路 因为两个球体之间,如果 两个球心的距离 <= 两个球体的半径之和 那么这两个球体 就…
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…
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…
最小生成树,用了Kruskal算法.POJ上C++能过,G++不能过... 算出每两个圆心之间的距离,如果距离小于两半径之和,那么这两个圆心之间的距离直接等于0,否则等于距离-R[i]-R[j]. #include<stdio.h> #include<string.h> #include<math.h> #include<algorithm> using namespace std; ; struct abc{ int start, end; double…
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…
全程double精度就能过了 间接0距离不用管 prim自动连起来的 G++交的话只能用%f输出 C++的话加不加l都可以 (这么说以后用%f肯定不会错咯) 不过我不懂为什么他们的空间时间差了好多倍... #include <cstdio> #include <cmath> #include <cstring> #include <queue> #include <vector> #include <algorithm> #defin…
题目传送门 题意:给出n个三维空间的球体,球体是以圆心坐标+半径来表示的,要求在球面上建桥使所有的球联通,求联通所建桥的最小长度. 分析:若两点距离大于两半径和的长度,那么距离就是两点距离 - 半径和,否则为0,Prim写错了,算法没有完全理解 /************************************************ * Author :Running_Time * Created Time :2015/10/25 12:00:48 * File Name :POJ_2…
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…
只是坐标变成三维得了,而且要减去两边的半径而已 题目 //最小生成树,只是变成三维的了 #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 题目链接: 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…
空间站是有一些球状的房间组成的,现在有一些房间但是没有相互连接,你需要设计一些走廊使他们都相通,当然,有些房间可能会有重合(很神奇的样子,重合距离是0),你需要设计出来最短的走廊使所有的点都连接. 分析:因为给的都是点的坐标,所以构图的时候会有一些麻烦,不过也仅此而已... ******************************************************************* #include<iostream> #include<cstring>…
最小生成树模板题 注意最后输出用%f (从C99开始%f已经不能用于输出double 即 输入用%lf 输出用%f) #include<cstdio> #include<algorithm> #include<cmath> #include<cstring> #include<string> #define M(a,b) memset(a,b,sizeof(a)) #define debug(x) cerr<<#x<<&q…
题目大意:在三维坐标中给出n个细胞的x,y,z坐标和半径r.如果两个点相交或相切则不用修路,否则修一条路连接两个细胞的表面,求最小生成树. 题目思路:最小生成树树模板过了,没啥说的 #include<cstdio> #include<cstdlib> #include<cmath> #include<iostream> #include<algorithm> #include<cstring> #include<vector&g…
题目: 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…
3维空间中有N个圆球,给出x y z 以及圆球的半径 ,求最小生成树 边的权值为两个圆球间的距离 如果圆球相互接触 则权值为0 求最小的权值和 Sample Input 3 //n10.000 10.000 50.000 10.000 //x y z r40.000 10.000 50.000 10.00040.000 40.000 50.000 10.000230.000 30.000 30.000 20.00040.000 40.000 40.000 20.00055.729 15.143…
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…
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…
#include<stdio.h> #include<math.h> #include<stdlib.h> #define N 200 double co(double a,double b) { return  (a-b)*(a-b); } struct node { double x,y,z,r; }a[N]; struct nodee{ double len; int x,y; }map[N*N]; int pre[N]; int find(int x) { if…
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…
#include<iostream> #include<cmath> #include<algorithm> #include<cstdio> using namespace std; const int N=1e5; struct edge{ int a,b; double w; }e[N]; double x[N],y[N],z[N],r[N]; int n,tot,p[N]; bool cmp(edge a,edge b) { return a.w&l…
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…
OJ上的一些水题(可用来练手和增加自信) (POJ 3299,POJ 2159,POJ 2739,POJ 1083,POJ 2262,POJ 1503,POJ 3006,POJ 2255,POJ 3094) 初期: 一.基本算法: 枚举. (POJ 1753,POJ 2965) 贪心(POJ 1328,POJ 2109,POJ 2586) 递归和分治法. 递推. 构造法.(POJ 3295) 模拟法.(POJ 1068,POJ 2632,POJ 1573,POJ 2993,POJ 2996) 二…
著名题单,最初来源不详.直接来源:http://blog.csdn.net/a1dark/article/details/11714009 OJ上的一些水题(可用来练手和增加自信) (POJ 3299,POJ 2159,POJ 2739,POJ 1083,POJ 2262,POJ 1503,POJ 3006,POJ 2255,POJ 3094) 初期: 一.基本算法: 枚举. (POJ 1753,POJ 2965) 贪心(POJ 1328,POJ 2109,POJ 2586) 递归和分治法. 递…
训练赛20151122 5:00:00     Overview Problem Status Rank Discuss Current Time: 2015-11-23 17:33:18 Contest Type: Public Start Time: 2015-11-22 08:30:00 Contest Status: Ended End Time: 2015-11-22 13:30:00 Manager: hrbustacm Clone this contest     ID Origi…