其他分享
首页 > 其他分享> > 1004 成绩排名

1004 成绩排名

作者:互联网

n = int(input())
# 用来存所有的学生信息
stu_infos = []
min_score = 101
max_score = 0
min_number = -1
max_number = -1
for i in range(n):
    # 依次输入每个学生的信息
    student_info = input()
    # 将输入的学生信息按空格进行分割并加入到列表中
    stu_infos.append(student_info.split(' '))
for i in range(n):
    num = int(stu_infos[i][2])
    if num > max_score:
        max_score = num
        max_number = i
    if num < min_score:
        min_score = num
        min_number = i
print(stu_infos[max_number][0] + " " + stu_infos[max_number][1])
print(stu_infos[min_number][0] + " " + stu_infos[min_number][1], end="")

标签:成绩排名,min,max,number,stu,score,infos,1004
来源: https://blog.csdn.net/qq_42708183/article/details/121160459