PAT 1018.锤子剪刀布 C++
2017-11-29 17:28
357 查看
#include <iostream> #include<stdio.h> using namespace std; //用最朴实的方法,没错,我就是这么lo int main() { int B1=0,B2=0,C1=0,C2=0,J1=0,J2=0,n; cin>>n; int p=0; char a,b; for(int i=0;i<n;i++) { cin>>a>>b; if((a=='C')&&(b=='B')) { B2++; }else if((a=='C')&&(b=='J')) { C1++; }else if((a=='B')&&(b=='C')) { B1++; }else if((a=='B')&&(b=='J')) { J2++; }else if((a=='J')&&(b=='C')) { C2++; }else if((a=='J')&&(b=='B')){ J1++; }else { p++; } } int win1=C1+B1+J1; int win2=C2+B2+J2; cout<<win1<<" "<<p<<" "<<win2<<endl; cout<<win2<<" "<<p<<" "<<win1<<endl; if(B1>C1&&B1>J1) { cout<<"B "; if(B2>C2&&B2>J2) { cout<<"B"; }else if(C2>B2&&C2>J2) { cout<<"C"; }else if(J2>B2&&J2>C2) { cout<<"J"; }else if(B2==C2&&B2>J2) { cout<<"B"; }else if(B2==J2&&B2>C2) { cout<<"B"; }else if(C2==J2&&C2>B2) { cout<<"C"; }else if(C2==J2&&C2==B2) { cout<<"B"; } }else if(C1>B1&&C1>J1) { cout<<"C "; if(B2>C2&&B2>J2) { cout<<"B"; }else if(C2>B2&&C2>J2) { cout<<"C"; }else if(J2>B2&&J2>C2) { cout<<"J"; }else if(B2==C2&&B2>J2) { cout<<"B"; }else if(B2==J2&&B2>C2) { cout<<"B"; }else if(C2==J2&&C2>B2) { cout<<"C"; }else if(C2==J2&&C2==B2) { cout<<"B"; } }else if(J1>B1&&J1>C1) { cout<<"J "; if(B2>C2&&B2>J2) { cout<<"B"; }else if(C2>B2&&C2>J2) { cout<<"C"; }else if(J2>B2&&J2>C2) { cout<<"J"; }else if(B2==C2&&B2>J2) { cout<<"B"; }else if(B2==J2&&B2>C2) { cout<<"B"; }else if(C2==J2&&C2>B2) { cout<<"C"; }else if(C2==J2&&C2==B2) { cout<<"B"; } }else if(B1==C1&&B1>J1) { cout<<"B "; if(B2>C2&&B2>J2) { cout<<"B"; }else if(C2>B2&&C2>J2) { cout<<"C"; }else if(J2>B2&&J2>C2) { cout<<"J"; }else if(B2==C2&&B2>J2) { cout<<"B"; }else if(B2==J2&&B2>C2) { cout<<"B"; }else if(C2==J2&&C2>B2) { cout<<"C"; }else if(C2==J2&&C2==B2) { cout<<"B"; } }else if(B1==J1&&B1>C1) { cout<<"B "; if(B2>C2&&B2>J2) { cout<<"B"; }else if(C2>B2&&C2>J2) { cout<<"C"; }else if(J2>B2&&J2>C2) { cout<<"J"; }else if(B2==C2&&B2>J2) { cout<<"B"; }else if(B2==J2&&B2>C2) { cout<<"B"; }else if(C2==J2&&C2>B2) { cout<<"C"; }else if(C2==J2&&C2==B2) { cout<<"B"; } }else if(C1==J1&&C1>B1) { cout<<"C "; if(B2>C2&&B2>J2) { cout<<"B"; }else if(C2>B2&&C2>J2) { cout<<"C"; }else if(J2>B2&&J2>C2) { cout<<"J"; }else if(B2==C2&&B2>J2) { cout<<"B"; }else if(B2==J2&&B2>C2) { cout<<"B"; }else if(C2==J2&&C2>B2) { cout<<"C"; }else if(C2==J2&&C2==B2) { cout<<"B"; } }else if(C1==J1&&C1==B1) { cout<<"B "; if(B2>C2&&B2>J2) { cout<<"B"; }else if(C2>B2&&C2>J2) { cout<<"C"; }else if(J2>B2&&J2>C2) { cout<<"J"; }else if(B2==C2&&B2>J2) { cout<<"B"; }else if(B2==J2&&B2>C2) { cout<<"B"; }else if(C2==J2&&C2>B2) { cout<<"C"; }else if(C2==J2&&C2==B2) { cout<<"B"; } } }
相关文章推荐
- 【C++】浙大PAT (Basic Level)1018. 锤子剪刀布 (20)
- C++ - PAT - 1018. 锤子剪刀布 (20)
- 1018. 锤子剪刀布 (20) PAT
- PAT Basic Level 1018. 锤子剪刀布 (20) 及最后一个测试点运行超时问题解决
- PAT-1018 锤子剪刀布
- PAT 1018 锤子剪刀布
- PAT乙级1018. 锤子剪刀布(20)
- 【PAT】(乙级)1018. 锤子剪刀布 (20)
- PAT-B 1018. 锤子剪刀布 (20)
- PAT BASIC 1018 锤子剪刀布
- PAT (Basic Level) Practise (中文) 1018. 锤子剪刀布 (20)
- PAT (Basic Level) Practise (中文)1018. 锤子剪刀布 (20)
- PAT乙级1018. 锤子剪刀布 (20)
- PAT 乙级 1018. 锤子剪刀布 (20)
- pat(B) 1018. 锤子剪刀布
- PAT1018 BASIC:锤子剪刀布 (20)
- PAT BASIC LEVEL 1018. 锤子剪刀布 (20)
- 乙级 PAT 1018. 锤子剪刀布 (20)
- PAT --- 1018. 锤子剪刀布 (20)
- PAT1018. 锤子剪刀布 (20)