题解 | #成绩排序#
成绩排序
https://www.nowcoder.com/practice/8e400fd9905747e4acc2aeed7240978b
import sys num1 = int(input().strip()) just1 = input().strip() table1 = [] for line in sys.stdin: a = line.strip().split(" ") table1.append([a[0],int(a[1])]) if just1 == '1': resualt1 = sorted(table1,key=lambda x:x[1]) elif just1 == '0': resualt1 = sorted(table1,key=lambda x:x[1],reverse=True) for i in resualt1: print(i[0],i[1])