摘要:        
一次通过,刚学prim的时候做过一道类似的,将每个点之间的距离保存在double型的邻接矩阵里,然后调用prim#include <iostream>#include <algorithm>#include <iomanip>#include <cstring>#include <cmath>using namespace std;#ifndef ONLINE_JUDGE#include <fstream>ifstream fin("test.txt");#define cin fin#endifdou    阅读全文
posted @ 2013-05-23 20:13
see_why
阅读(159)
评论(0)
推荐(0)
        
            
        
        
摘要:        
实在是太粗心了,floyd算法中把k打成了i,找了20分钟才找到错.... 题目不难,最多用6个人就能联系在一起,等价于任意2点的距离不超过7#include <iostream>#include <algorithm>#include <cstring>using namespace std;#ifndef ONLINE_JUDGE#include <fstream>ifstream fin("test.txt");#define cin fin#endifint graph[110][110],n,m;const int     阅读全文
posted @ 2013-05-23 19:06
see_why
阅读(179)
评论(0)
推荐(0)
        
            
        
        
摘要:        
思路是用并查集判断连通,然后判断边数+1==点数,就是判断是否为一颗生成树#include <iostream>#include <set>#include <algorithm>using namespace std;#ifndef ONLINE_JUDGE#include <fstream>ifstream fin("test.txt");#define cin fin#endifconst int MAXN = 100010;int p[MAXN],vis[MAXN],maxv,edge,ok;set<int>    阅读全文
posted @ 2013-05-23 15:18
see_why
阅读(178)
评论(0)
推荐(0)
        
 
                    
                
 
         浙公网安备 33010602011771号
浙公网安备 33010602011771号