文章
6
粉丝
369
获赞
1
访问
49.3k
#include<stdio.h>
const int inf = 1<<31-1;
typedef struct road {
int a;
int b;
int c;
}road;
typedef struct city {
int cnt;
int len[51];
}city;
int min(city a[][51],int i,int j) {
int temp = inf;
for (int m = 1; m < 51; m++) {
if (a[i][j].len[m]!=0&&a[i][j].len[m] < temp)temp = a[i][j].len[m];
}
return temp;
}
int dijsktra(city a[][51], int n) {
int i, j, minx;
int k = 0;
int vset[51] = { 0 };
int v[51] = { 0 };
for (i = 1; i <= n; i++) {
vset[i] = 0;
v[i] = min(a,1,i);
}
vset[1] = 1;
for (i = 1; i...
登录后发布评论
暂无评论,来抢沙发