思路:一种一种情况做判断,实在是太麻烦
#include<cstdio>
int main()
{
int n;
scanf("%d",&n);
int timesA[3]={0},timesB[3]={0};
int handA[3]={0},handB[3]={0};//BCJ
for(int i=0;i<n;i++)
{
char c1,c2;
scanf("%c%c",&c1,&c2);
if(c1=='B'&&c2=='C')
{
timesA[0]++;
timesB[2]++;
handA[0]++;
}
else if(c1=='B'&&c2=='J')
{
timesA[2]++;
timesB[0]++;
handB[2]++;
}
else if(c1=='C'&&c2=='B')
{
timesA[2]++;
timesB[0]++;
handB[0]++;
}
else if(c1=='C'&&c2=='J')
{
timesA[0]++;
timesB[2]++;
handA[1]++;
}
else if(c1=='J'&&c2=='B')
{
timesA[0]++;
timesB[2]++;
handA[2]++;
}
else if(c1=='J'&&c2=='C')
{
timesA[2]++;
timesB[0]++;
handB[1]++;
}
else
{
timesA[1]++;
timesB[1]++;
}
for(int i=0;i<3;i++)
{
printf("%d ",timesA[i]);
printf("%d ",timesB[i]);
}
}
}
另:发现锤子剪刀布的关系,此处需完善!!!