标签:
2 2 10 10 20 20 3 1 1 2 2 1000 1000
1414.2 oh!
#include <iostream> #include<cstdio> #include<cstring> #include<cmath> #include<climits> #include<vector> using namespace std; const int maxn=1005; double dis[maxn]; bool vis[maxn]; int x[maxn],y[maxn]; int i,j,n,t; double sum; struct node { int num; double d; node(int a,double b){num=a; d=b;} }; vector<node> s[maxn]; bool prim() { sum=0; bool flag=0; int k; vis[1]=1; for(int i=0;i<s[1].size();i++) dis[s[1][i].num]=s[1][i].d; for(int i=1;i<n;i++) { double minn=INT_MAX*1.0; for(int j=1;j<=n;j++) if(!vis[j] && minn>dis[j]) {
标签:
原文地址:http://www.cnblogs.com/stepping/p/5723136.html