/**
* 1.本题解析:见注释。
*
* 2.参考博客:https://www.liuchuo.net/archives/2742
* */
#include <iostream>
#include <vector>
using namespace std;
int main() {
int n, m, temp;
scanf("%d%d", &n, &m);
//score数组表示每道题的分值
//ans数组表示每道题的答案
vector<int> score(m), ans(m);
for(int i = 0; i < m; i++)
scanf("%d", &score[i]);
for(int i = 0; i < m; i++)
scanf("%d", &ans[i]);
for(int i = 0; i < n; i++) {
int total = 0;
for(int j = 0; j < m; j++) {
scanf("%d", &temp);
//如果他给出的答案temp等于正确答案ans[j]
if(temp == ans[j])
//则将这道题的分数score[j]累加到total中
total += score[j];
}
printf("%d\n", total);
}
return 0;
}
1061 判断题
最新推荐文章于 2024-03-28 09:13:38 发布