显示代码纯文本
#include<iostream>
#include<cstdio>
#include<algorithm>
int fk[201][3],nm[201],wc[201];
using namespace std;
int main ()
{
freopen("rps.in","r",stdin);
freopen("rps.out","w",stdout);
int N,Na,Nb,ansa=0,ansb=0,j=1;
cin>>N>>Na>>Nb;
for(int i=1;i<=Na;i++)
cin>>nm[i];
for(int i=1;i<=Nb;i++)
cin>>wc[i];
for(int i=1;i<=N;i++)
{
if(j>Na)
j=1;
fk[i][1]=nm[j];
j++;
}
j=1;
for(int i=1;i<=N;i++)
{
if(j>Nb)
j=1;
fk[i][2]=wc[j];
j++;
}
for(int i=1;i<=N;i++)
{
if(fk[i][1]==0)
{
if(fk[i][2]==2||fk[i][2]==3)
ansa++;
if(fk[i][2]==1||fk[i][2]==4)
ansb++;
}
if(fk[i][1]==1)
{
if(fk[i][2]==0||fk[i][2]==3)
ansa++;
if(fk[i][2]==2||fk[i][2]==4)
ansb++;
}
if(fk[i][1]==2)
{
if(fk[i][2]==1||fk[i][2]==4)
ansa++;
if(fk[i][2]==0||fk[i][2]==3)
ansb++;
}
if(fk[i][1]==3)
{
if(fk[i][2]==2||fk[i][2]==4)
ansa++;
if(fk[i][2]==0||fk[i][2]==1)
ansb++;
}
if(fk[i][1]==4)
{
if(fk[i][2]==0||fk[i][2]==1)
ansa++;
if(fk[i][2]==2||fk[i][2]==3)
ansb++;
}
}
cout<<ansa<<' '<<ansb;
return 0;
}