俺写的代码如下
name = list(input().split())
math = list(map(int, input().split()))
chinese = list(map(int, input().split()))
english = list(map(int, input().split()))
list_len = len(name)
list_score1 = []
list_score2 = list_score1
class Student:
sum_score = 0
def __init__(self, s_name, m_score, c_score, e_score):
self.s_name = s_name
self.m_score = m_score
self.c_score = c_score
self.e_score = e_score
def get_sum(self):
for i in range(0, list_len):
self.sum_score += self.m_score[i] + self.c_score[i] + self.e_score[i]
list_score1.append(self.sum_score) # 本身就带上了位置的标签
def get_best(self):
list_score1.sort()
for k in range(0, list_len):
if list_score2[k] == list_score1[0]:
best_name = self.s_name[k]
print(f'{best_name} {self.m_score[k]} {self.c_score[k]} {self.e_score[k]}', end='')
student = Student(name, math, chinese, english)
student.get_sum()
student.get_best()
测试的输入如下:
Jack Tom Jim
95 84 32
90 75 45
85 90 67
然鹅只通过部分测试点为什么?哪里有纰漏鸭?