解题思路:
注意事项:
参考代码:
# 读取输入
n = int(input())
students = [] # 学生列表,每个元素为一个列表:[学号, 语文成绩, 总成绩]
for i in range(n):
scores = list(map(int, input().split()))
student_id = i + 1
students.append([student_id, scores[0], sum(scores)])
# 按照规则排序
students.sort(key=lambda x: (-x[2],-x[1],x[0]))
# 输出前五名学生的学号和总分
for i in range(5):
print(students[i][0], students[i][2])
0.0分
0 人评分
永远的丰碑 (C语言代码)浏览:656 |
简单的a+b (C语言代码)浏览:647 |
母牛的故事 (C语言代码)浏览:934 |
大神老白 (C语言代码)浏览:645 |
2003年秋浙江省计算机等级考试二级C 编程题(1) (C语言代码)浏览:605 |
WU-复数求和 (C++代码)浏览:2015 |
C语言程序设计教程(第三版)课后习题4.9 (C语言代码)浏览:635 |
Cylinder (C语言描述,蓝桥杯)浏览:1247 |
C语言训练-数字母 (C语言代码)浏览:608 |
关于C语言变量位置的问题浏览:273 |