显示代码纯文本
#include <fstream>
using namespace std;
int jcases[5][5] = {
{0, -1, 1, 1, -1},
{1, 0, -1, 1, -1},
{-1, 1, 0, -1, 1},
{-1, -1, 1, 0, 1},
{1, 1, -1, -1, 0}
};
int n, na, nb, sa[200], sb[200];
int scorea, scoreb;
int main(){
fstream in("rps.in", ios::in), out("rps.out", ios::out);
in >> n >> na >> nb;
for(int i = 0; i < na; ++i) in >> sa[i];
for(int i = 0; i < nb; ++i) in >> sb[i];
for(int i = 0; i < n; ++i){
if(jcases[sa[i%na]][sb[i%nb]] == 1) ++scorea;
else if(jcases[sa[i%na]][sb[i%nb]] == -1) ++scoreb;
}
out << scorea << " " << scoreb;
return 0;
}