Shirlies
宁静专注认真的程序媛~
摘要: 模板题目了,又一个Krustral变形。。。题意:给你P个点,目前有S个卫星频道(satellite channels),求一条边在连接后中的图中是最大的,但是要求是所用方案中最小的,明显的最小生成树。求最小生成树中最长的那条边就可以了,但是那些最长的边可以卫星通讯(Any two outposts with a satellite channel can communicate via the satellite,其实这里还是有一个疑问的:要是a,b用卫星频道,c,d也用卫星频道,那么如果这两段不用radio是不是也可以通讯啊,根据题意应该是不可以的,如果可以就A不了了),所以求第P-S条最 阅读全文
posted @ 2012-04-16 16:42 Shirlies 阅读(625) 评论(0) 推荐(1) 编辑
摘要: Krustral 变形。。。。。。代码如下: 1 #include <cstdio> 2 #include <cstring> 3 #include <algorithm> 4 #include <cmath> 5 6 struct distance 7 { 8 int u,v; 9 double w;10 }d[1000000];11 12 struct point13 {14 int x,y;15 }p[1000];16 17 int f[1000];18 int n;19 int num;20 21 bool cmp(const dista 阅读全文
posted @ 2012-04-16 13:02 Shirlies 阅读(202) 评论(0) 推荐(0) 编辑
摘要: 这一题不错。。。将floyd变了变形。。。代码如下: 1 #include <cstdio> 2 #include <cstring> 3 #include <algorithm> 4 5 int point,street,que; 6 int g[1010][1010]; 7 int cas; 8 9 bool init()10 {11 scanf("%d%d%d",&point,&street,&que);12 if(point == 0&&street == 0&&que == 阅读全文
posted @ 2012-04-16 11:16 Shirlies 阅读(227) 评论(0) 推荐(0) 编辑