Input 과 output 예제가 왜 그렇게 나왔는지 이해 하는데에서 많은 오해를 해서 의도하지 않은 삽질을 하게 되었습니다. 나름대로 시작은 testCase 만들면서 했지만 제대로 테스트 케이스 만들면서 진행은 하지를 못했습니다. 그래서 테스트 케이스는 올리지 않았습니다. {{{~cpp class Airport: def __init__(self,cityNum,trafficList, configureList): self.cityNum = cityNum self.trafficList = [] self.configureList = [] for trafficData in trafficList: trafficOfCity = [] for traffic in trafficData[:-1]: trafficOfCity.append(int(traffic)) self.trafficList.append(trafficOfCity) for configureData in configureList: configureOfCity = [] for configure in configureData: eachConfigure = [] for conf in configure[:-1]: eachConfigure.append(int(conf)) configureOfCity.append(eachConfigure) self.configureList.append(configureOfCity) def calculateTraffic(self): trafficResult = [] confNum=1 for configure in self.configureList: traffic=0 for con in configure[0]: departureGate = con for i in range(2,len(self.trafficList[departureGate-1]),2): arrivalGate = self.trafficList[departureGate-1][i] traffic+=(abs(configure[1].index(arrivalGate)-configure[0].index(departureGate))+1)*self.trafficList[departureGate-1][i+1] trafficResult.append((confNum,traffic)) confNum+=1 trafficResult.sort(lambda x,y: cmp(x[1],y[1])) return trafficResult class VonNeumannAirport: def __init__(self): self.airportList = [] def readFile(self): Data = file("airport.in") cityNum = int(Data.readline().split(" ")[0]) while cityNum != 0: trafficList = [] configureList = [] for i in range(0,cityNum): trafficList.append(Data.readline().split(" ")) while Data.readline().split(" ")[0] != '0': readLineOne = Data.readline().split(" ") readLineTwo = Data.readline().split(" ") configureList.append((readLineOne,readLineTwo)) airport = Airport(cityNum, trafficList, configureList) self.airportList.append(airport) cityNum = int(Data.readline().split(" ")[0]) def calculateAllTraffic(self): result = [] for airport in self.airportList: result.append(airport.calculateTraffic()) return result vonAirport = VonNeumannAirport() vonAirport.readFile() AllResult = vonAirport.calculateAllTraffic() for result in AllResult: print "Configuration Load" for case in result: print str(case[0]) + " " + str(case[1]) }}}