10
C J
J B
C B
B B
B C
C C
C B
J B
B C
J J

5 3 2
2 3 5
B B

### AC代码：

``````#include <bits/stdc++.h>
using namespace std;
char getMax(int b,int c,int j)
{
if(b!=c&&b!=j&&c!=j)
{
if(b>c&&b>j)
{
return 'B';
}
if(c>b&&c>j)
{
return 'C';
}
if(j>b&&j>c)
{
return 'J';
}
}
else
{
if(b==c&&b>j)
{
return 'B';
}
if(b==c&&b<j)
{
return 'J';
}
if(c==j&&c>b)
{
return 'C';
}
if(c==j&&c<b)
{
return 'B';
}
if(b==j&&b>c)
{
return 'B';
}
if(b==j&&b<c)
{
return 'C';
}
if(b==j&&c==j&&b==c)
{
return 'B';
}
}
return '1';
}
int main()
{
int n;
cin >> n;
int count_XC=0,count_XJ=0,count_XB=0;
int count_YC=0,count_YJ=0,count_YB=0;
int count_Xwin=0,count_Xlose=0,count_Xequal=0;
for (int i = 0; i < n; ++i)
{
char X,Y;
cin >> X >> Y;
if(X == Y)
{
count_Xequal++;
}
else
{
bool X_defeat_Y = false;
if((X=='C'&&Y=='J')||(X=='J'&&Y=='B')||(X=='B'&&Y=='C'))
{
X_defeat_Y = true;
}
if(X_defeat_Y)
{
switch(X)
{
case 'C': count_XC++; break;
case 'J': count_XJ++; break;
case 'B': count_XB++; break;
default : break;
}
count_Xwin++;
}
else
{
switch(Y)
{
case 'C': count_YC++; break;
case 'J': count_YJ++; break;
case 'B': count_YB++; break;
default : break;
}
count_Xlose++;
}
}
}
cout << count_Xwin << " " << count_Xequal << " " << count_Xlose << endl;
cout << count_Xlose << " " << count_Xequal << " " << count_Xwin << endl;
int max_X=-1e5,max_Y=-1e5;
char maxc_X = getMax(count_XB,count_XC,count_XJ);
char maxc_Y = getMax(count_YB,count_YC,count_YJ);
cout << maxc_X << " " << maxc_Y << endl;
return 0;
}``````