Pythonwhile True:try:lis = list(map(int,input().split()))Judge = [[],[],[]]index_ = 0while len(Judge[2]) != 3:for i in range(len(Judge)):Judge[i].append(lis[index_])index_ += 1
Ans1 = [[Judge[0][0],Judge[1][1],Judge[2][2]],[Judge[0][0],Judge[1][2],Judge[2][1]],[Judge[0][1],Judge[1][2],Judge[2][0]],[Judge[0][1],Judge[1][0],Judge[2][2]],[Judge[0][2],Judge[1][1],Judge[2][0]],[Judge[0][2],Judge[1][0],Judge[2][1]]]
Judge = []for i in Ans1:Judge.append(sum(i))
max_ = max(Judge)Judge1 = []for i in range(len(Judge)):if Judge[i] == max_:x = Ans1[i]trashcan = []while len(trashcan) != 3:min_ = x.index(min(x))if min_ == 0:trashcan.append('B')x[min_] = float('inf')elif min_ == 1:trashcan.append('G')x[min_] = float('inf')else:trashcan.append('C')x[min_] = float('inf')Judge1.append(trashcan)
last = min(Judge1)Ans = ''.join(last)print(f'{Ans} {sum(lis) - max_}')except:break
似乎是沒按照順序輸出