EddyspictureTimeLimit:20001000MS(JavaOthers) MemoryLimit:6553632768K(JavaOthers) Eddy‘s picture Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 6723 Accepted Submiss
Eddy‘s picture
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 6723 Accepted Submission(s): 3391
Problem DescriptionEddy begins to like painting pictures recently ,he is sure of himself to become a painter.Every day Eddy draws pictures in his small room, and he usually puts out his newest pictures to let his friends appreciate. but the result it can be imagined, the friends are not interested in his picture.Eddy feels very puzzled,in order to change all friends ‘s view to his technical of painting pictures ,so Eddy creates a problem for the his friends of you.Problem descriptions as follows: Given you some coordinates pionts on a drawing paper, every point links with the ink with the straight line, causes all points finally to link in the same place. How many distants does your duty discover the shortest length which the ink draws?InputThe first line contains 0
Sample Input31.0 1.02.0 2.02.0 4.0
Sample Output3.41
题意:给定n个点的坐标,求将这n个点连起来的最小生成树。
题解:直接套模板。
#include #include #include #define maxn 102double _x[maxn], _y[maxn];double map[maxn][maxn];bool vis[maxn];double cal(int i, int j){double x = _x[i] - _x[j];double y = _y[i] - _y[j];return sqrt(x * x + y * y);}void Prim(int n){int i, j, count = 0, u;double len = 0, tmp;vis[0] = 1;while(countHDU1162 Eddys picture 【最小生成树Prim】,,
HDU1162 Eddys picture 【最小生成树Prim】