http://acm.hdu.edu.cn/showproblem.php?pid=2164

剪刀石头布,无脑模拟

View Code
#include <stdio.h>
int gao(char p1,char p2)
{
    if(p1=='S'&&p2=='P')return 1;
    if(p1=='P'&&p2=='R')return 1;
    if(p1=='R'&&p2=='S')return 1;
    if(p2=='S'&&p1=='P')return 2;
    if(p2=='P'&&p1=='R')return 2;
    if(p2=='R'&&p1=='S')return 2;
    return 0;
}
int main()
{
    int t,n;
    char p1,p2;
    int sc1,sc2;
    scanf("%d",&t);
    while(t--)
    {
        sc1=sc2=0;
        scanf("%d",&n);
        while(n--)
        {
            scanf("%*c%c %c",&p1,&p2);
            if(gao(p1,p2)==1)
                sc1++;
            else if(gao(p1,p2)==2)
                sc2++;
            else
                continue;
        }
        if(sc1>sc2)puts("Player 1");
        else if(sc1<sc2)puts("Player 2");
        else puts("TIE");
    }
    return 0;
}