You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

72 lines
985 B

///*
// * map05.cpp
// *
// * Created on: May 11, 2024
// * Author: 28032
// */
//
//#include <iostream>
//
//using namespace std;
//
//int g[1005][1005];
//
//
//int n,m;
//
//int minVertex(int *D,bool *visited)
//{
// int v,i;
// for(i = 1;i <= n;i++)
// if(visited[i] == false)
// {
// v = i;
// break;
// }
// for(i++;i <= n;i++)
// if(visited[i] == false && D[i] < D[v])
// v = i;
// return v;
//}
//
//int main()
//{
// cin>>n>>m;
//
// for(int i = 1;i <= m;i++)
// {
// int a,b,c;
// cin>>a>>b>>c;
// g[a][b] = c;
// g[b][a] = c;
// }
//
// int D[n+1];
// bool visited[n+1];
// int ans = 0;
//
// for(int i = 0;i <=n;i++)
// {
// D[i] = 1e7;
// visited[i] = false;
// }
// D[1] = 0;
//
// for(int i = 1;i <= n;i++)
// {
// int v = minVertex(D,visited);
// visited[v] = true;
//
// ans+=D[v];
//
// for(int j = 1;j <=n;j++)
// {
// if(!visited[j] && g[v][j] && D[j] > g[v][j])
// D[j] = g[v][j];
// }
// }
// cout<<ans<<endl;
//
// return 0;
//}