题目链接:https://pintia.cn/problem-sets/994805260223102976/problems/994805321640296448
思路:
比较就完了,如果符合当前最大(最小)条件,就更新名字和学号。
参考代码:
a = int(input())
maxi = -1
mini = 101
for i in range(0, a):
line = input()
cmp = line.split()
if int(cmp[2]) > maxi:
c = line
maxi = int(cmp[2])
if int(cmp[2]) < mini:
d = line
mini = int(cmp[2])
c = c.split()
d = d.split()
print(c[0] + " " + c[1])
print(d[0] + " " + d[1])