topic
Time Limit
400 ms
Memory Limit
65536 kB
Code Length Limit
8000 B
Judgment Program
Standard
Authors
CHEN, Yue
Judgment of judgment questions is very simple, this question requires you to write a simple program to help the teacher judge the questions and count the scores of the students' judgment questions.
Input format:
The input gives two positive integers N and M not exceeding 100 in the first line, which are the number of students and the number of true or false questions. The second line gives M positive integers not exceeding 5, which are the full score of each question. The third line gives the correct answer for each question, with 0 for "no" and 1 for "yes". Next N lines, each with a student's answer. The numbers are separated by spaces.
Output format:
Output the scores of each student in the order of input, and each score occupies one line.
Input sample:
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
analyze:
Save the score with the answer, and the answer will add points
Code (cpp):
#include<iostream>
using namespace std;
struct question{
int fullScore;
int rightAns;
};
int main(){
int n,m;
struct question que[100+5];
cin>>n>>m;
for(int i=0;i<m;i++)
cin>>que[i].fullScore;
for(int i=0;i<m;i++)
cin>>que[i].rightAns;
for(int i=0;i<n;i++){
int count=0;
for(int j=0;j<m;j++){
int ans;
cin>>ans;
if(ans == que[j].rightAns)
count += que[j].fullScore;
}
cout<<count<<endl;
}
return 0;
}