摘要:
很好的最小生成树的模板题,由于用邻接矩阵存储的,故用prim算法比较方便。AC code:prim 1 #include <iostream> 2 using namespace std; 3 int n, q, sum; 4 const int MAX = 101; 5 const int INF = 100000; 6 int map[MAX][MAX], vis[MAX], dis[MAX]; 7 8 void init() 9 {10 int i, j, tx, ty;11 for(i = 1; i <= n; i++){12 for(j = 1; j... 阅读全文
posted @ 2012-04-20 11:17
背着超人飞
阅读(160)
评论(0)
推荐(0)