U E D R , A S I H C RSS

Ecological Bin Packing/임인택

indexes = '123 132 213 231 312 321'.split()
chars = ['BCG','BGC','CBG','CGB','GBC','GCB' ]
results = []

def RecycleBin():
    data = raw_input().split()
    for str in indexes : # seq in indexes
        sum=0
        num=[int(str[0])-1, int(str[1])+2, int(str[2])+5]
        for i in range(0,9):
            if not (i== num[0] or \
               i== num[1] or \
               i== num[2] ):
                sum+=int(data[i])
        results.append(sum)
    min=1000
    idx=0
    for i in range(len(results)):
        if min>results[i]:
            min=results[i]
            idx=i
    print chars[idx],results[idx]

RecycleBin()
Valid XHTML 1.0! Valid CSS! powered by MoniWiki
last modified 2021-02-07 05:23:10
Processing time 0.0187 sec