简单最小生成树
#include<stdio.h>
#include<stdlib.h>
#define inf 0x3fffffff
int f[1010],n,map[1010][1010];
struct op
{
int x,y,w;
}p[10100];
int find(int a)
{
if(a!=f[a])
f[a]=find(f[a]);
return f[a];
}
int cmp(const void *a,const void *b)
{
struct op *c,*d;
c=(struct op *)a;
d=(struct op *)b;
return c->w-d->w;
}
int main()
{
int i,j,a,b,c,num,count,sum,m;
while(scanf("%d%d",&n,&m)!=-1)
{
num=0;
for(i=0;i<n;i......
阅读全文