题解 | #成绩排序#
成绩排序
https://www.nowcoder.com/practice/8e400fd9905747e4acc2aeed7240978b
while 1: try: n = int(input()) flag = input() if flag == '0': flag = True else: flag = False ls = [] for i in range(n): name, mark = input().split() ls.append([name, int(mark)]) l = sorted(ls, key=lambda x: x[1], reverse=flag) for i in range(n): print(l[i][0], l[i][1], end='\n') except: break