学校举行编程比赛,共有 M 个班级参加,总计 N 名学生提交了作品。每份作品有一个班级编号(1 到 M)和得分。现需要统计每个班级的最高得分,并计算所有班级最高得分的总和。分数为非负数。以下程序试图实现此功能,横线处应填写的代码是?( )

nn180174 单选题 共 个子题
M, N = map(int, input().split())
max_score = [0] * (M + 1)
for _ in range(N):
    cls, score = map(int, input().split())
    _____①_____
        max_score[cls] = score
_____②_____
print(total)
A

① if score > max_score[cls]:,② total = sum(max_score[0:M])

B

① if score < max_score[cls]:,② total = sum(max_score[1:])

C

① if score > max_score[cls]:,② total = sum(max_score[1:])

D

① if score >= max_score[cls]:,② total = sum(scores)

正在加载题目数据…
已答 /
子题
该题型需在试卷/作业中作答,单题练习暂不支持
答案解析
讨论
发布
登录后参与讨论 立即登录
发布讨论需先绑定并验证手机号 去绑定手机号
加载中…
我
我
回复 @
回复 @
发送
还没有人讨论,来发表第一条吧