def GetSepNumInputList(): inputList = [] try: inputnum = int(input()) except EOFError: print("input num error") while True: try: inputval = input().strip().split() inputList.append(inputval) if len(inputList) == inputnum: break except EOFError: break return inputList
def SortMedalList(inputList): MedalInforDict = {} for index in range(len(inputList)): medallist = inputList[index] if len(medallist) > 3: totalval = 200 * int(medallist[1]) + 1.01 * int(medallist[2]) + 0.01 * int(medallist[3]) MedalInforDict[medallist[0]] = totalval SortedMedalInforList = sorted(MedalInforDict.items(), key=lambda item:item[1], reverse=True) strlist = [] for index in range(len(SortedMedalInforList)): strlist.append(SortedMedalInforList[index][0]) sortedstrlist = sorted(strlist, reverse=True) for index in range(len(sortedstrlist)): MedalInforDict[sortedstrlist[index]] = MedalInforDict[sortedstrlist[index]] + (0.001 * index) SortedMedalInforList = sorted(MedalInforDict.items(), key=lambda item: item[1], reverse=True) strlist = [] for index in range(len(SortedMedalInforList)): strlist.append(SortedMedalInforList[index][0]) for str in strlist: print(str) return