Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

注意边界比较,i==m时要判断

Posted by atopoxo at 2011-06-04 10:17:17 on Problem 2395
我的程序的主要部分:
int Kruskal(){
	int i,k,max=0;
	init_set();
	for(i=1,k=0;i<=m;i++)
		if(find_father(edge[i].u)!=find_father(edge[i].v)){
			union_set(edge[i].u,edge[i].v);
			k++;
			if(max<edge[i].w)    max=edge[i].w;
			if(k==n-1)       return max;
		}
}

Followed by:

Post your reply here:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator