0
点赞
收藏
分享

微信扫一扫

1.24(Shortest Path)

犹大之窗 2022-01-24 阅读 56
c++

Shortest Path | JXNUOJ

描述:

There is a graph with N nodes. Given the length of each edge between the nodes. Find the shortest path from S to E.

输入:

First line: three positive integer number N (N <= 100), S (S <= N), E(E <= N).
Next N lines: the i-th line contains N non-negative integers (<= 100), indicating the length of edge from the i-th node to any nodes.

输出:

One line contains several integers, indicating the indexes of node in the shortest path from S to E.

样例输入:

4 1 4
0 3 6 8
3 0 2 9
6 2 0 2
8 9 2 0

样例输出:

1 2 3 4

翻译:

描述:

这是一张有N个结点的图,给定结点之间每条边的长度,寻找S到E最短的路程。

输入:

第一行:三个正整数N,S,E(N <= 100)(S <= N)(E <= N)

以下N行:第i行包含N个非负数的整数(<=100),表示从第i个节点到任何节点的边的长度。

输出:

一行包含几个数字。表示从S到E最短路程的结点下标。

样例输入:

4 1 4
0 3 6 8
3 0 2 9
6 2 0 2
8 9 2 0

样例输出:

1 2 3 4
举报

相关推荐

0 条评论