题目大意:
石头剪刀布,谁赢多,谁就胜利。
解题思路:
纯模拟。
#include
using namespace std;
int judge(char a ,char b)
{
if((a == 'P' && b == 'R') || (a == 'S' && b == 'P')
|| (a == 'R' && b == 'S'))
return 1;
else if((a == 'R' && b == 'P') || (a == 'P' && b =='S')
|| (a == 'S' && b == 'R'))
return -1;
else
return 0;
}
int main(void)
{
int n;
char ch1, ch2;
scanf("%d", &n);
for(int i = 0; i < n; i++)
{
int m, total = 0;
scanf("%d", &m);
for(int i = 0; i < m; i++)
{
getchar();
scanf("%c %c", &ch1, &ch2);
total += judge(ch1, ch2);
}
if(total > 0)
printf("Player 1\n");
else if(total < 0)
printf("Player 2\n");
else
printf("TIE\n");
}
return 0;
}