PTA 乙级 1061 判断题 (15分) C/C++
回实验室了,今天的题简单,不多讲
1 #include<iostream> 2 #include<vector> 3 4 using namespace std; 5 6 int main() { 7 int n = 0, m = 0; 8 cin >> n >> m; 9 vector<int> grade(m); 10 vector<int> right(m); 11 for (int i = 0; i < m; ++i) cin >> grade[i]; 12 for (int i = 0; i < m; ++i) cin >> right[i]; 13 for (int i = 0; i < n; ++i) { 14 int sum = 0; 15 for (int j = 0; j < m; ++j) { 16 int tmp = 0; 17 cin >> tmp; 18 if (tmp == right[j]) sum += grade[j]; 19 } 20 cout << sum << endl; 21 } 22 return 0; 23 }
默默地一点点变强,细节决定成败