#include<iostream>
#include<map>
using namespace std;
map<int, int>cTop;//card to position
map<int, int>pToc;//position to card
int sh[54];
void shuffle(int times) {
for (int i = 1; i <= 54; i++) cin >> sh[i - 1];
while (times != 0) {
for (int i = 1; i <= 54; i++) {
int card = pToc[i];
int temp = sh[i - 1];
cTop[card] = temp;
}
for (auto it : cTop)
pToc[it.second] = it.first;
times--;
}
}
int main() {
for (int i = 1; i <= 54; i++) {
cTop[i] = i; pToc[i] = i;
}
int times; cin >> times;
shuffle(times); map<int, int>::iterator ii = pToc.end();
int count = 0;
for (auto it : pToc) {
int card = it.second; char put;
if (card >= 1 && card <= 13) put = 'S';
else if (card >= 14 && card <= 26) put = 'H';
else if (card >= 27 && card <= 39) put = 'C';
else if (card >= 40 && card <= 52) put = 'D';
else put = 'J';
cout << put << ((card % 13==0)?13:(card%13));
count++;
if (count!=54) cout << " ";
}
return 0;
}
|