luogu P1328 生活大爆炸版石头剪刀布

 1 #include <cstdio>
 2 using namespace std;
 3 int n,na,nb;
 4 int mp[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}};
 5 int vec[3][250],ans[3];
 6 int main()
 7 {
 8     scanf("%d%d%d",&n,&na,&nb);
 9     for (int i = 0;i < na;i++) scanf("%d",&vec[1][i]);
10     for (int i = 0;i < nb;i++) scanf("%d",&vec[2][i]);
11     for (int i = 0;i < n;i++)
12     {
13         int a = vec[1][i % na],b = vec[2][i % nb];
14         ans[1] += mp[a][b];
15         ans[2] += mp[b][a];
16     }
17     printf("%d %d\n",ans[1],ans[2]);
18     return 0;
19 }

 

posted @ 2019-07-20 17:54  IAT14  阅读(130)  评论(0编辑  收藏  举报