1018 锤子剪刀布(20 分)

#include
#include
#include
using namespace std;
char num[3] = { 'B','C','J' };
int a[3], b[3];
int n;
int as, ap, af, bs, bp, bf;
void show(int a[])
{
    int k = 0;
    for (int i = 0; i < 3; i++)
    {
        if (a[k] < a[i])k = i;
    }
    printf("%c", num[k]);
}
int main()
{
    mapmp;
    mp['B'] = 0;
    mp['C'] = 1;
    mp['J'] = 2;
    scanf("%d", &n);
    while (n--)
    {
        getchar();
        char aa, bb;
        scanf("%c %c", &aa, &bb);
        int k1 = mp[aa];
        int k2 = mp[bb];
        if ((k1 + 1) % 3 == k2)
        {
            as++;
            a[k1]++;
            bf++;
        }
        else if ((k2 + 1) % 3 == k1)
        {
            bs++;
            af++;
            b[k2]++;
        }
        else if (k1 == k2)
        {
            bp++, ap++;
        }
    }
    printf("%d %d %d\n", as, ap, af);
    printf("%d %d %d\n", bs, bp, bf);
    show(a);
    printf(" ");
    show(b);
    return 0;
}

你可能感兴趣的:(1018 锤子剪刀布(20 分))