2019-12-12
16:08:38
#include <bits/stdc++.h> #include<math.h> using namespace std; int main(){ int N; cin>>N; int win1=0,win2=0,win3=0,lose1=0,win4=0,win5=0,win6=0,lose2=0,balance=0;//win1,win2,win3,lose1代表甲赢输,win4,win5,win6,lose2代表乙赢输 for(int i=0;i<N;++i){ char a,b; cin>>a>>b; if(a == ‘B‘ && b == ‘C‘){ win1++; lose2++; } if(a == ‘C‘ && b==‘J‘){ win2++; lose2++; } if(a == ‘J‘ && b==‘B‘){ win3++; lose2++; } if(a == ‘C‘&& b == ‘B‘){ win4++; lose1++; } if(a == ‘J‘ && b == ‘C‘){ win5++; lose1++; } if(a == ‘B‘ && b == ‘J‘){ win6++; lose1++; } if((a==‘B‘&&b==‘B‘)||(a==‘C‘&&b==‘C‘)||(a==‘J‘&&b==‘J‘)){ balance++; } } //cout<<(win1+win2+win3)<<" "balance<<" "lose1<<endl; //cout<<(win4+win5+win6)<<" "balance<<" "lose2<<endl; printf("%d %d %d\n",(win1+win2+win3),balance,lose1); printf("%d %d %d\n",(win4+win5+win6),balance,lose2); int max1 = 0; max1 = max(win1,max(win2,win3)); /*if(max1 == win1){ cout<<‘B‘<<" "; } if(max1 == win2){ cout<<‘C‘<<" "; } if(max1 == win3){ cout<<‘J‘<<" "; }*/ for(int i = 0;i<3;++i){ if(max1 == win1){ cout<<‘B‘<<" "; break; } if(max1 == win2){ cout<<‘C‘<<" "; break; } if(max1 == win3){ cout<<‘J‘<<" "; break; } } int max2 = 0; max2 = max(win4,max(win5,win6)); /*if(max2 == win4){ cout<<‘B‘; } if(max2 == win5){ cout<<‘C‘; } if(max2 == win6){ cout<<‘J‘; }*/ for(int i = 0;i<3;++i){ if(max2 == win4){ cout<<‘B‘; break; } if(max2 == win5){ cout<<‘C‘; break; } if(max2 == win6){ cout<<‘J‘; break; } } system("pause"); return 0; }