设有A、B、C、D、E五人从事J1,J2,J3,J4,J5五项工作,每人只能从事一项 python

data = https://www.it610.com/article/[ [0,0,0,0,0,0], [0,13,11,10,4,7], [0,13,10,10,8,5], [0,5,9,7,7,4], [0,15,12,10,11,5], [0,10,11,8,8,4] ]p = [0 for i in range(6)] f = [0 for i in range(10)] g = [0 for i in range(10)] Max = 0def dfs(step,t): global Max for i in range(1,6): if p[i] == 0: f[step] = i p[i] = 1 t += data[step][i] if step<5: dfs(step+1,t) elif t>Max: Max = t for j in range(1,6): g[j] = f[j] print(g[j],end=" ") print() t -= data[step][i] p[i] = 0dfs(1,0)

    推荐阅读