生活大爆炸版锤子剪刀布(NOIP2014)(真·模拟)

水!水!!水!!!(重要的事情说三遍。。)

1分钟代码题。。

原题传送门

这题啊,手打BOOL判断,然后乱搞啊。。

这有什么难的。。

加个快读就能拿第一啦。。

膜9018上各位大佬们。。

下面贴代码

#include<iostream>
#include<cstdio>
using namespace std;
bool f[5][5];
int na[201],nb[201];
int n,q1,q2;
int total1,total2;
int main(){
    f[2][4]=true;
    f[3][4]=true;
    f[1][3]=true;
    f[0][3]=true;
    f[0][2]=true;
    for(int i=0;i<=4;i++)
    for(int j=i+1;j<=4;j++)
    f[j][i]=!f[i][j];
    scanf("%d",&n);
    scanf("%d%d",&q1,&q2);
    for(int i=1;i<=q1;i++)
    scanf("%d",&na[i]);
    for(int i=1;i<=q2;i++)
    scanf("%d",&nb[i]);
    int num1=1;int num2=1;
    for(int i=1;i<=n;i++)
    {
        if(na[num1]!=nb[num2])
        {
            if(f[na[num1]][nb[num2]])total1++;
            else total2++;
        }
        if(++num1>q1)num1=1;
        if(++num2>q2)num2=1;
    }
    printf("%d %d
",total1,total2);
}
原文地址:https://www.cnblogs.com/ghostfly233/p/6854978.html