[NOIP2014 提高组] 生活大爆炸版石头剪刀布
2024年12月25日小于 1 分钟
#include <bits/stdc++.h>
using namespace std;
int a[5][5] = {
1, 0, 2, 2, 0,
5, 1, 0, 2, 0,
5, 5, 1, 0, 2,
5, 5, 5, 1, 2,
5, 5, 5, 5, 1};
int N, Na, Nb;
int x[205];
int y[205];
int main()
{
ios::sync_with_stdio(false);
cin.tie(0);
for (int i = 0; i <= 4; i++)
for (int j = 0; j <= 4; j++)
if (a[i][j] == 5)
a[i][j] = 2 - a[j][i];
cin >> N >> Na >> Nb;
for (int i = 0; i <= Na - 1; i++)
cin >> x[i];
for (int i = 0; i <= Nb - 1; i++)
cin >> y[i];
int xScore = 0;
int yScore = 0;
for (int i = 0; i <= N - 1; i++)
{
int xx = x[i % Na];
int yy = y[i % Nb];
int now = a[xx][yy];
if (now == 2)
xScore++;
if (now == 0)
yScore++;
}
cout << xScore << " " << yScore;
return 0;
}