以下是使用 Python 解决此问题的代码: ```python n = int(input()) # 输入学生人数 heights = list(map(int, input().split())) # 输入学生身高 # 先对身高进行排序 heights.sort(reverse=True) # 找出第二高的身高 second_highest = heights[1] # 找出第二高身高对应的学号 for i in range(n): if heights[i] == second_highest: student_id = i + 1 break print(student_id, second_highest) # 额外注意的逻辑点: # 1. 输入数据的合法性检查,比如 n 的范围和身高值的范围。 # 2. 考虑使用更高效的排序算法,比如快速排序。 # 3. 处理可能的异常情况,如输入格式错误。 ``` [2025-05-14 19:40:08 | AI写代码神器 | 194点数解答]