网易互娱的第二题是我这么写的,动态的删除数组 while True: try: n = int(input()) ss = [] for _ in range(n): ss.append(list(map(int,input().split()))) for i in range(n): max_count = 0 loc_i = 0 loc_j = 0 for j in range(n-i): for w in range(n-i): if sum(ss[j][:])+sum(ss[:][w])-ss[j][w] > max_count: max_count=sum(ss[j][:])+sum(ss[:][w])-ss[j][w] loc_i = j loc_j = w for q in range(n-i): del ss[q][loc_j] ss.remove(ss[loc_i]) print(str(loc_i+1)+' &(5528)#39;+str(loc_j+1)) except: break