7 条题解
-
0
#include #include using namespace std;
- const int Maxn=40; int a[Maxn],n; int main() { string a; cin>>n>>a; int x1=0,x2=0,x3=0; for(int i=0;i<=n;i++){ if(a[i]'a'||a[i]'A'){ x1+=1; } if(a[i]'b'||a[i]'B'){ x2+=1; } if(a[i]'c'||a[i]'C'){ x3+=1; } } if(x1>=x2 &&x1>=x3){ cout<<"a"<<" "<<x1<<endl; cout<<"b"<<" "<<x2<<endl; cout<<"c"<<" "<<x3<<endl; } if(x1>=x2 &&x1>=x3 &&x3>x1){ cout<<"a"<<" "<<x1<<endl; cout<<"c"<<" "<<x3<<endl; cout<<"b"<<" "<<x2<<endl; } if(x2>x1 && x2>=x3 && x1>=x3){ cout<<"b"<<" "<<x2<<endl; cout<<"a"<<" "<<x1<<endl; cout<<"c"<<" "<<x3<<endl; } if(x2>x1 && x2>=x3 && x3>x1){ cout<<"b"<<" "<<x2<<endl; cout<<"c"<<" "<<x3<<endl; cout<<"a"<<" "<<x1<<endl; } if(x3>x1 && x3>x2 && x1>=x2){ cout<<"c"<<" "<<x3<<endl; cout<<"a"<<" "<<x1<<endl; cout<<"b"<<" "<<x2<<endl; } if(x3>x1 && x3>x2 && x2>x1){ cout<<"c"<<" "<<x3<<endl; cout<<"b"<<" "<<x2<<endl; cout<<"a"<<" "<<x1<<endl; } return 0; }
信息
- ID
- 52
- 时间
- 1000ms
- 内存
- 128MiB
- 难度
- 7
- 标签
- 递交数
- 944
- 已通过
- 242
- 上传者