题目:
考察内容:
sort(双排序)+ if + dict(keys;items())
代码:
"""
analyze:input:
int n 学生人数; int m 科目数量
科目名称(不重复)
人名(不会重名) + 科目成绩
。。。。
。。。。
排名的科目output:
按成绩排序的名字,空格隔开(成绩相同,按照学生姓名字典排序)
eg:
3 2
yuwen shuxue
fangfang 95 90
xiaohua 88 95
mimmim 100 95
shuxue3 2
yuwen shuxue
fangfang 95 90
xiaohua 88 95
mimmim 100 82
zhongfenway"""while True:n, m = map(int, input().split())subject = input().split()student_score = dict()for _ in range(n):temp = input().split()student_score.update({temp[0]: temp[1:]})sort_subject = input()# print(n, m)# print(subject)# print(student_score)# print(sort_subject)if sort_subject in subject:index = subject.index(sort_subject)res = sorted(student_score.items(), key=lambda x: (-int(x[1][index]), x[0]))else:# 按照总分进行排序res = sorted(student_score.items(), key=lambda x: (-sum(map(int, x[1])), x[0]))print(" ".join(dict(res).keys()))