kurXX最小生成树.DOC

kurXX最小生成树.DOC

ACM算法资料集锦 2009年12月10日星期四 PAGE \* MERGEFORMAT PAGE \* MERGEFORMAT 1 kurXX最小生成树 #include iostream #include math.h #include algorithm using namespace std; #define M 501 #define LIMstruct edg{ int u,v; int w; }all_e[M*M/2]; bool operator (const edg a,const edg b){ return a.wb.w; } int set[M]; inline bool uni(int set[],int a,int b){ int ac=0,a2=a,b2=b,bc=0; while(set[a]!=0) {a=set[a];ac++;} if(a2!=a) set[a2]=a; while(set[b]!=0) {b=set[b];bc++;} if(b2!=b) set[b2]=b; if(a==b) return fal

文档评论(0)

1亿VIP精品文档

相关文档