#A. 【例9.5】城市交通网络

    Type: Default 1000ms 256MiB

【例9.5】城市交通网络

You cannot submit for this problem because the contest is ended. You can click "Open in Problem Set" to view this problem in normal mode.

【题目描述】

下图表示城市之间的交通路网,线段上的数字表示费用,单向通行由A->E。试用动态规划的最优化原理求出A->E的最省费用。

image

如图:求v1到v10的最短路径长度及最短路径。

【输入】

第一行为城市的数量N(<=20);

后面是N*N的表示两个城市间费用组成的矩阵。

【输出】

A->E的最省费用。

【输入样例】

10
0  2  5  1  0  0  0  0  0  0
0  0  0  0 12 14  0  0  0  0
0  0  0  0  6 10  4  0  0  0
0  0  0  0 13 12 11  0  0  0
0  0  0  0  0  0  0  3  9  0
0  0  0  0  0  0  0  6  5  0
0  0  0  0  0  0  0  0 10  0
0  0  0  0  0  0  0  0  0  5
0  0  0  0  0  0  0  0  0  2
0  0  0  0  0  0  0  0  0  0

【输出样例】

minlong=19
1 3 5 8 10

【来源】

一本通在线评测

C23天河-DP3-线性DP基本题和经典题

Not Claimed
Status
Done
Problem
7
Open Since
2024-3-25 0:00
Deadline
2024-5-31 23:59
Extension
24 hour(s)