Messager Problem(NOIOPJENGLISH20)

Messager Problem

https://acs.jxnu.edu.cn/problem/NOIOPJENGLISH20

 1000ms  65536K

描述:

There are N nodes in the graph. Given the length of edges between the nodes, find the shortest path of size N and the nodes in the path are all different.

图上有n个节点,给出每个节点间的长度,找到最小为n的路径并且每个节点的路径都是不同的

输入:

First line: one positive integer N (N <= 15).
Next N lines: the i-th line contains N non-negative integers (<= 1000) indicating the length of edges between the i-th node and other nodes.

第一行:一个正整数表示n

接下来n行:第i行包含n个非负整数表示第i个节点到其他点的距离

输出:

One line contains N integers, indicating the indexes of nodes in the shortest path.

一行包括n个整数,表示在最短路径中节点的序号

样例输入:

4
0 2 8 4
2 0 5 7
8 5 0 1
4 7 1 0

样例输出:

3 4 1 2
上一篇:shell脚本中for循环及while循环写法


下一篇:习题3.6 解释 string输入操作符cin>> 和 getline()函数如何处理空白字符