分析
模拟题,比较简单,用sort就能写
AC代码
#include<bits/stdc++.h>
using namespace std;
struct node{
string id;
int order;
}card[55];
string ch[5] = {"","S","H","C","D"};
string nm[14] = {"","1","2","3","4","5","6","7","8","9","10","11","12","13"};
int sh_order[55];
int comp(struct node a,struct node b){
return a.order<b.order;
}
int main(){
for(int i=1;i<=4;i++){
for(int j=1;j<=13;j++){
card[(i-1)*13+j].id = ch[i]+nm[j];
card[(i-1)*13+j].order = (i-1)*13+j;
}
}
card[53].id="J1";card[53].order=53;
card[54].id="J2";card[54].order=54;
int k;
cin>>k;
for(int i=1;i<=54;i++){
cin>>sh_order[i];
}
for(int i=0;i<k;i++){
for(int i=1;i<=54;i++){
card[i].order=sh_order[i];
}
sort(card+1,card+55,comp);
}
for(int i=1;i<55;i++){
if(i==1){
cout<<card[i].id;
}else{
cout<<" "<<card[i].id;
}
}
}