题解 | #成绩排序#
成绩排序
http://www.nowcoder.com/practice/8e400fd9905747e4acc2aeed7240978b
L.sort(key=lambda x:x[1])
while True:
try:
N = int(input())
re = int(input())
L = []
for i in range(N):
name, score = input().split()
L.append((name, int(score)))
if re==0:
L.sort(key=lambda x:x[1], reverse=True)
else:
L.sort(key=lambda x:x[1], reverse=False)
for i in L:
print("{} {}".format(i[0], i[1]))
except:
break