我的个人网站 Cheese的个人主页http://www.cheese.ren/
博客来源 PAT 乙级 1061 判断题-Cheese的个人博客PAT 乙级 1061 判断题http://blog.cheese.ren/81
欢迎交换友链 :-)
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, m;
while (scanf("%d %d", &n, &m) != EOF) {
// score
int score[m];
for (int i=0; i<m; i++)
scanf("%d", &score[i]);
// answer
int answer[m];
for (int i=0; i<m; i++)
scanf("%d", &answer[i]);
// student answer
for (int i=0; i<n; i++) {
int student_score=0;
for (int l=0; l<m; l++) {
int temp;
scanf("%d", &temp);
if (temp == answer[l])
student_score += score[l];
}
printf("%d\n", student_score);
}
}
return 0;
}