Subject to the effect
of my github
Subject to the effect
There are 54 cards, assume the start sequence is:
S1, S2, …, S13,
H1, H2, …, H13,
C1, C2, …, C13,
D1, D2, …, D13,
J1, J2
Now give a positive integer indicates the number of the shuffle, and then give a sequence, requires 54 sequence shuffled according to this following. Rank inIs the i-th position j, i-card will be placed in the position of the j
Entry
Each group contains a test, the first row use case is a positive integer
The second line 54 is a digital representation of sequence shuffling
Export
Card sequence after each washing the card use case, the output
Sample input
2
36 52 37 38 3 39 40 53 54 41 11 12 13 42 43 44 2 4 23 24 25 26 27 6 7 8 48 49 50 51 9 10 14 15 16 5 17 18 19 1 20 21 22 28 29 30 31 32 33 34 35 45 46 47
Sample Output
S7 C11 C10 C12 S1 H7 H8 H9 D8 D9 S11 S12 S13 D10 D11 D12 S3 S4 S6 S10 H1 H2 C13 D2 D3 D4 H6 H3 D13 J1 J2 C1 C2 C3 C4 D1 S5 H5 H11 H12 C6 C7 C8 C9 S2 S8 S9 H10 D5 D6 D7 H4 H13 C5
Resolve
Wash accordance with the rules over the cards, then output
# -*- coding: utf-8 -*-
# @Time : 2019/6/4 19:19
# @Author : ValarMorghulis
# @File : 1042.py
def solve():
t = ['S', 'H', 'C', 'D', 'J']
n = int(input())
a = list(map(int, input().split()))
ans = list()
for i in range(54):
tmp = "%c%d" % (t[i // 13], i % 13 + 1)
ans.append(tmp)
for j in range(n):
tans = ans.copy()
for i in range(54):
tans[a[i]-1] = ans[i]
ans = tans
print(*ans)
if __name__ == "__main__":
solve()