#32864: WA 求救TT


sshs912632@gmail.com (春楓)

學校 : 桃園市私立新興高級中學
編號 : 206577
來源 : [27.53.249.42]
最後登入時間 :
2022-09-27 09:38:25
c081. 00102 - Ecological Bin Packing -- UVa102 | From: [39.14.10.222] | 發表日期 : 2022-11-14 09:39

Python
 
while True:
    try:
        lis = list(map(int,input().split()))
        Judge = [[],[],[]]
        index_ = 0
        while 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
 
#32964: Re: WA 求救TT


cges30901 (cges30901)

學校 : 不指定學校
編號 : 30877
來源 : [39.9.74.255]
最後登入時間 :
2024-10-14 22:20:08
c081. 00102 - Ecological Bin Packing -- UVa102 | From: [118.231.185.180] | 發表日期 : 2022-11-19 21:58

Python
 
while True:
    try:
        lis = list(map(int,input().split()))
        Judge = [[],[],[]]
        index_ = 0
        while 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


似乎是沒按照順序輸出

 
ZeroJudge Forum