1042. Shuffling Machine

#include<iostream>
#include<vector>
#include<string>
using namespace std;
char topc[7]="SHCDJ";
int main(){
  vector<string> pk(54);
  for(int i=0;i<pk.size();++i)
    pk[i]+=topc[i/13],pk[i]+=to_string(i%13+1);
  int k;cin>>k;
  vector<int>shuf(54); for(auto&x:shuf)cin>>x;
  while(k--){
    vector<string>tmp(54);
    for(int i=0;i<54;++i)
      tmp[shuf[i]-1]=pk[i];
    pk=tmp;
  }
  for(int i=0;i<pk.size();++i)
    cout<<(i?" ":"")<<pk[i];
}

你可能感兴趣的:(1042. Shuffling Machine)