2021年1月28日 星期四

f441: 評分系統 Score

程式碼:

#include <iostream>
using namespace std;

int main()
{
	int n, points,studentN;
	cin >> n >> points;
	int* ans = new int[n];
	for (int i = 0; i < n; i++)
		cin >> ans[i];
	cin >> studentN;
	while (studentN--)
	{
		int score = 0, p;
		for (int i = 0; i < n; i++)
		{
			cin >> p;
			if (p == ans[i]) score += points;
		}
		cout << score << endl;
	}
}

沒有留言:

張貼留言