标签:inf min http pre 核心 复杂 floyd 不能 ima
初始化:
for (int i = 1; i <= n; i ++ )
for (int j = 1; j <= n; j ++ )
if (i == j) mp[i][j] = 0;
else mp[i][j] = INF;
// 算法结束后,mp[a][b]表示a到b的最短距离
void floyd()
{
for (int k = 1; k <= n; k ++ )
for (int i = 1; i <= n; i ++ )
for (int j = 1; j <= n; j ++ )
mp[i][j] = min(mp[i][j], mp[i][k] + mp[k][j]);
}
标签:inf min http pre 核心 复杂 floyd 不能 ima
原文地址:https://www.cnblogs.com/bingers/p/13234460.html