結果

問題 No.267 トランプソート
ユーザー 👑 yumechiyumechi
提出日時 2015-08-21 22:55:48
言語 Python3
(3.11.6 + numpy 1.26.0 + scipy 1.11.3)
結果
AC  
実行時間 18 ms / 1,000 ms
コード長 1,064 bytes
コンパイル時間 95 ms
コンパイル使用メモリ 11,064 KB
実行使用メモリ 8,368 KB
最終ジャッジ日時 2023-09-25 15:08:00
合計ジャッジ時間 1,608 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 15 ms
8,220 KB
testcase_01 AC 16 ms
8,368 KB
testcase_02 AC 17 ms
8,224 KB
testcase_03 AC 18 ms
8,356 KB
testcase_04 AC 17 ms
8,328 KB
testcase_05 AC 16 ms
8,188 KB
testcase_06 AC 16 ms
8,268 KB
testcase_07 AC 16 ms
8,220 KB
testcase_08 AC 16 ms
8,356 KB
testcase_09 AC 15 ms
8,180 KB
testcase_10 AC 16 ms
8,192 KB
testcase_11 AC 16 ms
8,272 KB
testcase_12 AC 17 ms
8,332 KB
testcase_13 AC 16 ms
8,184 KB
testcase_14 AC 16 ms
8,348 KB
testcase_15 AC 16 ms
8,148 KB
testcase_16 AC 16 ms
8,264 KB
testcase_17 AC 16 ms
8,264 KB
testcase_18 AC 15 ms
8,300 KB
testcase_19 AC 16 ms
8,236 KB
testcase_20 AC 16 ms
8,228 KB
testcase_21 AC 16 ms
8,248 KB
testcase_22 AC 16 ms
8,236 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

mark2number = {"A":1, "T":10, "J":11, "Q":12, "K":13}
number2mark = {1:"A", 10:"T", 11:"J", 12:"Q", 13:"K"}
cardmark2number = {"D":0, "C":1, "H":2, "S":3}
number2cardmark = {0:"D", 1:"C", 2:"H", 3:"S"}
cardlist = [[] for _ in range(4)]

n = int(input())
for s in input().split():
    s0, s1 = s[0], s[1]
    cardlist[cardmark2number[s0]].append(s1)

for i in range(4):
    for j in range(len(cardlist[i])):
        if cardlist[i][j] in mark2number:
            cardlist[i][j] = mark2number[cardlist[i][j]]
        else:
            cardlist[i][j] = int(cardlist[i][j])

for i in range(4):
    cardlist[i].sort()

for i in range(4):
    for j in range(len(cardlist[i])):
        if cardlist[i][j] in number2mark:
            cardlist[i][j] = number2mark[cardlist[i][j]]
        else:
            cardlist[i][j] = str(cardlist[i][j])

res = ""
for i in range(4):
    for j in range(len(cardlist[i])):
        cardlist[i][j] = number2cardmark[i] + cardlist[i][j]
    res += " ".join(cardlist[i])
    if i != 3 and len(cardlist[i]) > 0:
        res += " "

print(res)
0