Skip to content
This repository was archived by the owner on Dec 12, 2022. It is now read-only.

Floyd-Warshall #40

Open
UNICKCHENG opened this issue Aug 11, 2018 · 0 comments
Open

Floyd-Warshall #40

UNICKCHENG opened this issue Aug 11, 2018 · 0 comments
Assignees

Comments

@UNICKCHENG
Copy link
Contributor

UNICKCHENG commented Aug 11, 2018

Floyd-Warshall

待更新题库

[任务] 用Floyd算法求图中任意两点之间的最短距离
[接口]
void floyd()
复杂度:O(N3)
输入
    N 全局变量,图中的点数
    g 全局变量,g[i][j]表示点i到j之间的距离
输出
    g 全局变量,g[i][j]表示点i到j之间的最短距离

cosnt int maxn=111;
const int INF=1000000000;
int N,g[maxn][maxn];

void floyd()
{
	for(int k=1;k<=N;k++)
		for(int i=1;i<=N;i++)
			for(int j=1;j<=N;j++)
				g[i][j]=min(g[i][j],g[i][k]+g[k][j]);
}

题库

ID TITLE CODE(C/C++) 备注
POJ1502 MPI Maelstrom
@UNICKCHENG UNICKCHENG self-assigned this Aug 11, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant