map狂喜
2025-08-03 18:58:15
发布于:浙江
0阅读
0回复
0点赞
#include<unordered_map>
#include<iostream>
#include<algorithm>
using namespace std;
struct card_race{
string card;
int weight;
bool operator<(card_race& other){
return weight<other.weight;
}
};
unordered_map<string,int>poker = {{"3",0}, {"4",1}, {"5",2}, {"6",3},
{"7",4}, {"8",5}, {"9",6}, {"10",7}, {"J",8}, {"Q",9},
{"K",10}, {"A",11}, {"2",12}, {"Joker",13}};
int main() {
card_race match[110];
ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
int n;
cin >> n;
for (int i=1;i<=n;i++){
cin>>match[i].card;
match[i].weight=poker[match[i].card];
}
sort(match+1,match+n+1);
for (int i=1;i<=n;i++) cout<<match[i].card<<endl;
return 0;
}
这里空空如也
有帮助,赞一个