[NOIP 2014] 生活大爆炸版石头剪刀布

[题目链接]

http://uoj.ac/problem/15

[算法]

按题意模拟即可
[代码]

#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 ; }
上一篇:crypto-js计算文件的sha256值


下一篇:[luoguP1328] 生活大爆炸版石头剪刀布(模拟)