Skip to content

Latest commit

 

History

History
54 lines (49 loc) · 1.37 KB

OrganizeATeam-604.md

File metadata and controls

54 lines (49 loc) · 1.37 KB

604.组队

【解法1】观察法

print(98+99+98+97+98)

【解法2】暴力

import os
import sys

# 请在此输入您的代码
# mat = [
#   [97, 90, 0, 0, 0],
#   [92, 85, 96, 0, 0],
#   [0, 0, 0, 0, 93],
#   [0, 0, 0, 80, 86],
#   [89, 83, 97, 0, 0],
#   [82, 86, 0, 0, 0],
#   [0, 0, 0, 87, 90],
#   [0, 97, 96, 0, 0],
#   [0, 0, 89, 0, 0],
#   [95, 99, 0, 0, 0],
#   [0, 0, 96, 97, 0],
#   [0, 0, 0, 93, 98],
#   [94, 91, 0, 0, 0],
#   [0, 83, 87, 0, 0],
#   [0, 0, 98, 97, 98],
#   [0, 0, 0, 93, 96],
#   [98, 83, 99, 98, 81],
#   [93, 87, 92, 96, 98],
#   [0, 0, 0, 89, 92],
#   [0, 99, 96, 95, 81]
# ]
s1 = [97,92, 0, 0,89,82, 0, 0, 0,95, 0, 0,94, 0, 0, 0,98,93, 0, 0]
s2 = [90,85, 0, 0,83,86, 0,97, 0,99, 0, 0,91,83, 0, 0,83,87, 0,99]
s3 = [ 0,96, 0, 0,97, 0, 0,96,89, 0,96, 0, 0,87,98, 0,99,92, 0,96]
s4 = [ 0, 0, 0,80, 0, 0,87, 0, 0, 0,97,93, 0, 0,97,93,98,96,89,95]
s5 = [ 0, 0,93,86, 0, 0,90, 0, 0, 0, 0,98, 0, 0,98,86,81,98,92,81]
mat = [s1, s2, s3, s4, s5]
max_val = 0
for i in range(20):
  for j in range(20):
    for k in range(20):
      for m in range(20):
        for n in range(20):
          if i != j and i != k and i != m and i != n and j != k and j != m and j != n and k != m and k != n and m != n:
            if max_val < s1[i] + s2[j] + s3[k] + s4[m] + s5[n]:
              max_val = s1[i] + s2[j] + s3[k] + s4[m] + s5[n]
print(max_val)