Shirlies
宁静专注认真的程序媛~
摘要: Krustral是也。。。View Code 1 #include <cstdio> 2 #include <cstring> 3 #include <algorithm> 4 #include <cmath> 5 6 struct segment 7 { 8 int u,v; 9 double w;10 }s[10000];11 12 struct point13 {14 double x,y;15 }p[110];16 17 int f[105];18 int n;19 int sum;20 double len;21 22 bool cmp 阅读全文
posted @ 2012-04-15 23:30 Shirlies 阅读(264) 评论(0) 推荐(0) 编辑
摘要: 求最短路,Floyd算法,简单的应用不过题目真的很晦涩。。。第一个数x表示与第i个数(通俗一点,第i行,其实也是标号为i的点)相邻的点的个数,然后后面有x个值。代码如下: 1 #include <cstdio> 2 #include <cstring> 3 #include <algorithm> 4 5 int g[22][22]; 6 int n; 7 8 bool init() 9 {10 int num;11 for(int i = 1;i <= 20;i ++)12 {13 for(int j = 1;j <= 20;j ++)14 . 阅读全文
posted @ 2012-04-15 21:27 Shirlies 阅读(260) 评论(0) 推荐(0) 编辑
摘要: 这一题做的有点小苦,但是最终取得了成功,(*^__^*) 嘻嘻……起初不知道哪里出问题了,一直WA,然后对照网上的代码一步一步的改啊,提交啊,最终AC了,然后又一步一步的改回到自己原来的样子,(~ o ~)~zZ错误找到了。。。不知道WA了多少次,又AC了多少次,不计算了,而且我的代码运行时间比网上的代码时间更短,成就啊,不过有点小浪费空间,其实两个循环可以合并,就少一点空间了。。。代码如下: 1 #include <cstdio> 2 #include <cstring> 3 #include <algorithm> 4 5 int length[60]; 阅读全文
posted @ 2012-04-15 13:06 Shirlies 阅读(323) 评论(0) 推荐(0) 编辑