动态规划,看半天没看懂。。。 贴个网址,之后碰到不同类型的再仔细研究吧。 https://www.cnblogs.com/dongsheng/archive/2013/05/28/3104629.html