結果

問題 No.267 トランプソート
ユーザー lloyzlloyz
提出日時 2023-03-16 21:39:30
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 40 ms / 1,000 ms
コード長 827 bytes
コンパイル時間 681 ms
コンパイル使用メモリ 81,744 KB
実行使用メモリ 53,460 KB
最終ジャッジ日時 2023-10-18 13:13:57
合計ジャッジ時間 2,643 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 38 ms
53,460 KB
testcase_01 AC 38 ms
53,460 KB
testcase_02 AC 39 ms
53,460 KB
testcase_03 AC 38 ms
53,460 KB
testcase_04 AC 38 ms
53,460 KB
testcase_05 AC 38 ms
53,460 KB
testcase_06 AC 38 ms
53,460 KB
testcase_07 AC 39 ms
53,460 KB
testcase_08 AC 38 ms
53,460 KB
testcase_09 AC 39 ms
53,460 KB
testcase_10 AC 39 ms
53,460 KB
testcase_11 AC 39 ms
53,460 KB
testcase_12 AC 39 ms
53,460 KB
testcase_13 AC 39 ms
53,460 KB
testcase_14 AC 38 ms
53,460 KB
testcase_15 AC 39 ms
53,460 KB
testcase_16 AC 38 ms
53,460 KB
testcase_17 AC 39 ms
53,460 KB
testcase_18 AC 40 ms
53,460 KB
testcase_19 AC 39 ms
53,460 KB
testcase_20 AC 38 ms
53,460 KB
testcase_21 AC 39 ms
53,460 KB
testcase_22 AC 38 ms
53,460 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
A = list(input().split())

convert1 = {'A': 1, '2': 2, '3': 3, '4': 4, '5': 5, '6': 6, '7': 7, '8': 8,
            '9': 9, 'T': 10, 'J': 11, 'Q': 12, 'K': 13}
convert2 = {1: 'A', 2: '2', 3: '3', 4: '4', 5: '5', 6: '6', 7: '7', 8: '8',
            9: '9', 10: 'T', 11: 'J', 12: 'Q', 13: 'K'}
D, C, H, S = [], [], [], []
for i in range(n):
    s = A[i]
    if s[0] == 'D':
        D.append(convert1[s[1]])
    elif s[0] == 'C':
        C.append(convert1[s[1]])
    elif s[0] == 'H':
        H.append(convert1[s[1]])
    elif s[0] == 'S':
        S.append(convert1[s[1]])
D.sort()
C.sort()
H.sort()
S.sort()
ANS = []
for d in D:
    ANS.append('D' + convert2[d])
for c in C:
    ANS.append('C' + convert2[c])
for h in H:
    ANS.append('H' + convert2[h])
for s in S:
    ANS.append('S' + convert2[s])
print(*ANS)
0