data = https://www.it610.com/article/[
[0,0,0,0,0,0],
[0,97,90,0,0,0],
[0,92,85,96,0,0],
[0,0,0,0,0,93],
[0,0,0,0,80,86],
[0,89,83,97,0,0],
[0,82,86,0,0,0],
[0,0,0,0,87,90],
[0,0,97,96,0,0],
[0,0,0,89,0,0],
[0,95,99,0,0,0],
[0,0,0,96,97,0],
[0,0,0,0,93,98],
[0,94,91,0,0,0],
[0,0,83,87,0,0],
[0,0,0,98,97,98],
[0,0,0,0,93,86],
[0,98,83,99,98,81],
[0,93,87,92,96,98],
[0,0,0,0,89,92],
[0,0,99,96,95,81]
]b = [0 for i in range(10)]# 位置
g = [0 for i in range(10)]
Max = 0
def dfs(i,ans):
global Max
for j in range(1,21):
if b[i] == 0 and data[j][ i]:
b[i] = 1
g[i] = data[j][i]
ans += data[j][i]
if i<5:
dfs(i+1,ans)
elif ans>Max:
Max = ans
print("Max:",Max)
for k in range(1,6):
print(g[k],end=' ')
print()b[i] = 0
g[i] = 0
ans -= data[j][i]dfs(1,0)print("End-Max:",Max)