We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
#include<iostream> using namespace std; typedef long long ll; int n,w1,w2; int win1[3],win2[3]; int change(char c) { if(c=='B') return 0; else if(c=='C') return 1; else return 2; } int main() { cin>>n; for(int i=0; i<n; i++) { char a,b; cin>>a>>b; int k1=change(a),k2=change(b);//由于后续将按字典序排序输出胜利次数最多的手势,可将B、C、J分别编码下标对应 0 1 2, if((k1+1)%3==k2) { //又由于B、C、j循环相克,经分析可巧妙地发现得k1赢k2的条件是 (k1+1)%3==k2, w1++; win1[k1]++; } else if((k2+1)%3==k1) { w2++; win2[k2]++; } } cout<<w1<<" "<<n-w1-w2<<" "<<w2<<endl; cout<<w2<<" "<<n-w1-w2<<" "<<w1<<endl; char m[3]= {'B','C','J'}; int a=0,b=0; for(int i=1; i<3; i++) { if(win1[i]>win1[a])a=i; if(win2[i]>win2[b]) b=i; } cout<<m[a]<<" "<<m[b]; return 0; }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
The text was updated successfully, but these errors were encountered: