随笔分类 -  最小生成树

摘要:http://acm.hdu.edu.cn/showproblem.php?pid=1102 如果两个城市之间有边,则把其置为0,然后直接最小生成树,记录总距离。View Code 1 #include<iostream> 2 #include<cstring> 3 using namespace std; 4 const int N=108; 5 int mat[N][N]; 6 int dis[N]; 7 bool visited[N]; 8 int n; 9 int find()//在dis中找没访问的值最小的 10 {11 int pos=-1,minx=999 阅读全文
posted @ 2012-04-03 16:18 keepmoving89 阅读(132) 评论(0) 推荐(0)