[题目链接]
[算法]
按题意模拟即可
[代码]
#include<bits/stdc++.h>
using namespace std;
#define MAXN 210
const int mat[][] =
{
{,,,,},
{,,,,},
{,,,,},
{,,,,},
{,,,,}
} ; int i,Na,Nb,p,q,n,ans1,ans2;
int a[MAXN],b[MAXN]; int main()
{ scanf("%d%d%d",&n,&Na,&Nb);
for (i = ; i <= Na; i++) scanf("%d",&a[i]);
for (i = ; i <= Nb; i++) scanf("%d",&b[i]);
p = q = ;
for (i = ; i <= n; i++)
{
ans1 += mat[a[p]][b[q]];
ans2 += mat[b[q]][a[p]];
p = p % Na + ;
q = q % Nb + ;
}
printf("%d %d\n",ans1,ans2); return ; }