PAT B 1061 True or False

The code was released, we learn together, help each other
Title:

Sample input:

3 6
2 1 3 3 4 5
0 0 1 0 1 1
0 1 1 0 0 1
1 0 1 0 1 0
1 1 0 0 1 1

Sample output:

13
11
12

Code below (Python):

lst = list(map(int, input().split()))
question_score = list(map(int, input().replace(' ', '')))
right_answer = input().replace(' ', '')
student_answer = [input().replace(' ', '')for i in range(lst[0])]
student_score = [0 for j in range(lst[0])]
for i in range(lst[0]):
    for j in range(lst[1]):
        if student_answer[i][j] == right_answer[j]:
            student_score[i] += question_score[j]
for k in student_score:
    print(k)
Published 65 original articles · won praise 25 · views 1039

Guess you like

Origin blog.csdn.net/chongchujianghu3/article/details/104984183