【发布时间】:2016-07-20 16:38:46
【问题描述】:
我必须从位置 (0,0) 开始,我可以向上移动或向右移动(无对角线遍历)。我需要最小成本矩阵才能到达节点 (n-1,n-1)。我还需要以最低成本记录的路径。另外,我需要计算到目标节点的路径总数(n-1,n-1)。
例如。
Matrix:
7 9 2
1 5 8
2 3 7
Output:
Min cost path: 2 -> 1 -> 5 -> 8 -> 2
Sum(Min Cost Path excluding the ending node): 16
Total number of paths: 6
【问题讨论】:
-
这听起来像是您刚刚从家庭作业中输入了一个问题 - 提供您编写的代码或至少显示一些表明您已经自己努力解决这个问题的内容,并询问特定的无需为您完成作业即可回答的问题。
标签: algorithm path dynamic-programming minimum