Title Description
Rock-paper-scissors is a common finger-guessing game: rock wins scissors, scissors wins cloth, cloth win stone. If two people punching the same, then regardless of the outcome. In the "Big Bang" Season 8, there has been a focus of an upgraded version of rock-paper-scissors game.
Upgraded version of the game based on the traditional rock-paper-scissors game based on the addition of two new gestures:
Spock: One of the "Star Trek" protagonist.
Lizard Man: "Star Trek" villain.
Five gesture outcome of the relationship as shown in Table I, listed in Table A to B is the result of the game.
Now, 小 A
and 小 B
try to play this upgraded version of the finger-guessing game. They are all known punching regular periodic, but not necessarily equal to the cycle length. For example: If 小A
a "stone - cloth - rock - scissors - lizard - Spock," the cycle length of 66 punches, then he punches sequence is the "stone - cloth - rock - scissors - lizard - Spock - stone - cloth - rock - scissors - lizard - Spock -...... "and if 小B
the" scissors - stone - cloth - Spock - lizard man "cycle length is 55 punches, then he punches sequence is the "scissors - stone - cloth - Spock - lizard man - scissors - stone - cloth - Spock - lizards -......"
It is known 小 A
and 小 B
conducted a total of N N times mora. Every man to win 11 points, the loser get 00 points; draw both had 00 points. Now you statistics N N score two times after the end of the finger-guessing game.
Input Format
The first line contains three integers: N, N_A, N_B, represent a total of N times mora, 小 A
cycle length punches, 小 B
punches cycle length. With a space between the number and the number.
The second line contains N_A integers representing 小 A
the law of punches, the third line contains N_B integers representing 小 B
the law of punches. Where 0 represents "scissors", 1 for "rock", 2 "cloth", 3 for "Lizard Man", 4 indicates "Spock." With a space between the number and the number.
Output Format
An output line, comprising two integers, separated by a space, respectively 小 A
, 小 B
of the score.
Sample input and output
Input # 1
10 5 6
0 1 2 3 4
0 3 4 2 1 0
Output # 1
6 2
Input # 2
9 5 5
0 1 2 3 4
1 0 3 2 4
Output # 2
4 4
Description / Tips
To 100% of the data, 0 <N <= 200, 0 <N_A <= 200, 0 <N_B <= 200.
Thinking
Simple simulation,
Code
(Problem solution from Rockwell Valley)
#include <bits/stdc++.h>
using namespace std;
const int MAXN = 200 + 10;
int n, na, nb, a[MAXN], b[MAXN], cnta, cntb;
int vs[5][5] = {{0,0,1,1,0},{1,0,0,1,0},{0,1,0,0,1},{0,0,1,0,1},{1,1,0,0,0}}; //得分表的处理
int main()
{
cin >> n >> na >> nb;
for(int i = 0; i < na; i++) cin >> a[i];
for(int i = 0; i < nb; i++) cin >> b[i];
for(int i = 0; i < n; i++)
{
cnta += vs[a[i % na]][b[i % nb]]; //周期循环
cntb += vs[b[i % nb]][a[i % na]];
}
cout << cnta << " " << cntb << endl;
return 0;
}