Bootstrap

1061 判断题 python

#输入数据
stu_num,sub_num=[int(i) for i in input().split()]   #学生数,题目数
sub_grade_list=[int(i) for i in input().split()]    #题目分值
sub_answer_list=input().split()                     #题目答案
stu_answer_list=list()                              #学生答题列表
for i in range(stu_num):
    x=input().split()
    stu_answer_list.append(x)

#处理数据
stu_grade_list=[0 for i in range(stu_num)]          #学生成绩表
for i in range(stu_num):
    for j in range(sub_num):
        if stu_answer_list[i][j]==sub_answer_list[j]:
            stu_grade_list[i]+=sub_grade_list[j]

#输出结果
for i in range(stu_num):
    print(stu_grade_list[i])
;