Python题解 | #成绩排序#
成绩排序
https://www.nowcoder.com/practice/8e400fd9905747e4acc2aeed7240978b
import sys while True: try: n = int(input()) key = False if int(input()) else True dp = [] for i in range(n): a, b = map(str, input().strip().split()) dp.append((a, int(b))) res = sorted(dp, key=lambda x: x[1], reverse=key) for i in res: print(i[0], i[1]) except: break