PAT (Basic Level) 1061 判断题
作者:互联网
题意
判断题计分。
思路
水~
代码
#include <bits/stdc++.h>
using namespace std;
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
int n, m;
cin >> n >> m;
vector<int> score(m), right(m);
for (int& e : score) cin >> e;
for (int& e : right) cin >> e;
for (int i = 0; i < n; ++i) {
int sum = 0;
for (int j = 0, x; j < m; ++j) {
cin >> x;
if (x == right[j]) sum += score[j];
}
cout << sum << '\n';
}
return 0;
}
HINT
不定时更新更多题解,Basic Level 全部AC代码,详见 link ! ! !
标签:right,PAT,cout,Level,1061,cin,int,score,Basic 来源: https://blog.csdn.net/abcdefbrhdb/article/details/104638658