可以将此问题转化为0-1规划问题。得到最优解并输出最优方案的解法如下: #coding=utf-8 ''' 动态规划并输出路径 ''' while True: try: n, m = map(int,input().split()) pri,annex = {},{} index = {} # 存储最优方案 for i in range(0,n+1): index[i] = [] for i in range(1,m+1): x,y,z = map(int,...