for狂喜
2024-11-20 22:06:13
发布于:云南
1阅读
0回复
0点赞
#include<bits/stdc++.h>
using namespace std;
int to[25] = {0};
int main(){
int n; cin >> n;
for(int i = 1;i <= n;i++){
string s; cin >> s;
if(s.size() == 1){
if(s[0] == 'A') to[1]++;
else if(s[0] == 'J') to[11]++;
else if(s[0] == 'Q') to[12]++;
else if(s[0] == 'K') to[13]++;
else to[s[0] - '0']++;
}else if(s == "10") to[10]++;
else to[14]++;
}
for(int i = 1;i <= to[3];i++) cout << "3" << endl;
for(int i = 1;i <= to[4];i++) cout << "4" << endl;
for(int i = 1;i <= to[5];i++) cout << "5" << endl;
for(int i = 1;i <= to[6];i++) cout << "6" << endl;
for(int i = 1;i <= to[7];i++) cout << "7" << endl;
for(int i = 1;i <= to[8];i++) cout << "8" << endl;
for(int i = 1;i <= to[9];i++) cout << "9" << endl;
for(int i = 1;i <= to[10];i++) cout << "10" << endl;
for(int i = 1;i <= to[11];i++) cout << "J" << endl;
for(int i = 1;i <= to[12];i++) cout << "Q" << endl;
for(int i = 1;i <= to[13];i++) cout << "K" << endl;
for(int i = 1;i <= to[1];i++) cout << "A" << endl;
for(int i = 1;i <= to[2];i++) cout << "2" << endl;
for(int i = 1;i <= to[14];i++) cout << "Joker" << endl;
return 0;
}
这里空空如也
有帮助,赞一个