1018锤子剪刀布 (20分)
#include <iostream>
using namespace std;
int n, cnt, sumA, sumB;
int a[3], b[3];
int get(string s)
{
if (s == "J") return 0;
if (s == "C") return 1;
if (s == "B") return 2;
}
string uget(int t)
{
if (t == 0) return "J";
if (t == 1) return "C";
if (t == 2) return "B";
}
int getmax(int a[])
{
int x = 2;
for (int i = 1; i >= 0; i --)
if (a[i] > a[x]) x = i;
return x;
}
int main()
{
cin >> n;
for (int i = 0; i < n; i ++)
{
string x, y;
cin >> x >> y;
if (get(x) == get(y)) cnt ++;
else if ((get(x) + 1) % 3 == get(y)) b[get(y)]++;
else a[get(x)]++;
}
for (int i = 0; i <= 2; i ++)
{
sumA += a[i];
sumB += b[i];
}
cout << sumA << ' ' << cnt << ' ' << sumB << endl;
cout << sumB << ' ' << cnt << ' ' << sumA << endl;
cout << uget(getmax(a)) << ' ' << uget(getmax(b)) << endl;
return 0;
}
#include<iostream>
using namespace std;
int n;
int jiawin,yiwin, ping;
int jiages[3];
int yiges[3];
int get(char c)
{
if (c == 'c') return 0;
if (c == 'j') return 1;
return 2;
}
int main()
{
cin >> n;
for (int i = 0; i < n; i ++)
{
char a, b;
cin >> a >> b;
int x = get(a), y = get(b);
if (x == y)
{
ping ++;
}
else if ((x + 1) % 3 == y)
{
jiawin ++;
jiages[x] ++;
}
else
{
yiwin ++;
yiges[y] ++;
}
}
cout << jiawin <<" "<< n - jiawin - yiwin <<" " << yiwin << endl;
cout << yiwin <<" "<< n - jiawin - yiwin <<" "<< jiawin <<endl;
char maxges[4] = {"BCJ"};
int maxjia = jiages[0] >= jiages[1] ? 0 : 1;
maxjia = jiages[maxjia] >= jiages[2] ? maxjia : 2;
int maxyi = yiges[0] >= yiges[1] ? 0 : 1;
maxyi = yiges[maxjia] >= yiges[2] ? maxyi : 2;
cout << maxges[maxjia] <<" "<<maxges[maxyi];
return 0;
}