菜鸡1号


私信TA

用户名:uq_69651989863

访问量:893

签 名:

等  级
排  名 1196
经  验 2997
参赛次数 0
文章发表 48
年  龄 0
在职情况 学生
学  校
专  业

  自我简介:

TA的其他文章

表达式括号匹配
浏览:58
堆栈的使用
浏览:18
行编辑程序
浏览:16

解题思路:

注意事项:

参考代码:

def compare_students(student):
   name, age, score = student
   return (score, name, age)  # 按成绩、姓名、年龄的顺序进行排序


while True:
   try:
       n = int(input())  # 学生数量
       students = []
       for _ in range(n):
           name, age, score = input().split()
           students.append((name, int(age), int(score)))

       sorted_students = sorted(students, key=compare_students)

       for student in sorted_students:
           name, age, score = student
           print(name, age, score)

   except EOFError:
       break





 

0.0分

1 人评分

看不懂代码?想转换其他语言的代码? 或者想问其他问题? 试试问问AI编程助手,随时响应你的问题:

编程语言转换

万能编程问答  

代码解释器

代码纠错

SQL生成与解释

  评论区