A dynamic programming approach is good for this problem. For further improvement, it can be combined with a shortest path algorithm for graphs with nonnegative arc lengths.

 
  • 一个好的做法是动态规划。如果要进一步优化的话,可以结合一个应用于无负权弧的图的最短路算法。
今日热词
目录 附录 查词历史