程序填空题:学生排序
学生排序。对班里的所有学生,先按成绩从高到低排,成绩相同的按年龄从小到大排序,年龄相同的,按姓名从小到大排序。<br>
### 样例输入
5
Kitty 56 22
Hanmeimei 70 21
Alice 70 21
Joey 89 22
Tim 19 25
### 样例输出
oey 89 22
Alice 70 21
Hanmeimei 70 21
Kitty 56 22
Tim 19 25
c++
n = int(input())
for i in range(n):
s = input().split()
students.append((s[0],int(s[1]),int(s[2])))
students.sort(key = )
for x in students:
print(x[0], x[1],x[2])
答案:
第1空:students = []
第2空:lambda x: (-x[1],x[2],x[0])
### 样例输入
5
Kitty 56 22
Hanmeimei 70 21
Alice 70 21
Joey 89 22
Tim 19 25
### 样例输出
oey 89 22
Alice 70 21
Hanmeimei 70 21
Kitty 56 22
Tim 19 25
c++
n = int(input())
for i in range(n):
s = input().split()
students.append((s[0],int(s[1]),int(s[2])))
students.sort(key = )
for x in students:
print(x[0], x[1],x[2])
答案:
第1空:students = []
第2空:lambda x: (-x[1],x[2],x[0])