| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
先做邻接矩阵,再用这个In Reply To:请教高手给个好算法! 我的Prim超时了... Posted by:MasterLuo at 2008-08-21 19:10:33 c=0;
for(i=1;i<=n;i++)t[i]=jz[1][i];
for(i=2;i<=n;i++)
{
m=10000000;
for(k=1;k<=n;k++)
if(m>t[k]&&t[k]!=-1){m=t[k];x=k;}
c+=m;
for(k=1;k<=n;k++)
if(t[k]>jz[x][k])t[k]=jz[x][k];
}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator