所属作业: hw8
数据结构: 字典
算法: 排序
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
| n = int(input())
junger = []
laonianren = []
for i in range(n):
name,age = input().split()
age = int(age)
if age < 60:
junger.append(name)
else:
laonianren.append((-age, i))
for i in sorted(laonianren):
print(i[2])
for i in junger:
print(i)
|
1
2
3
4
5
6
7
| n=int(input())
sum=[]
for i in range(n):
id,age=input().split()
sum.append((i, (id), int(age)))
for i in sorted(sum, key=lambda x: (x[2] < 60, x[2] >= 60 and -int(x[2]), x[0])):
print(i[1])
|