結果

問題 No.267 トランプソート
ユーザー rlangevinrlangevin
提出日時 2023-01-14 13:24:38
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 94 ms / 1,000 ms
コード長 646 bytes
コンパイル時間 364 ms
コンパイル使用メモリ 87,068 KB
実行使用メモリ 71,668 KB
最終ジャッジ日時 2023-08-26 19:43:52
合計ジャッジ時間 3,978 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 91 ms
71,316 KB
testcase_01 AC 92 ms
71,540 KB
testcase_02 AC 93 ms
71,396 KB
testcase_03 AC 93 ms
71,312 KB
testcase_04 AC 93 ms
71,396 KB
testcase_05 AC 91 ms
71,612 KB
testcase_06 AC 91 ms
71,616 KB
testcase_07 AC 92 ms
71,668 KB
testcase_08 AC 94 ms
71,588 KB
testcase_09 AC 93 ms
71,444 KB
testcase_10 AC 93 ms
71,604 KB
testcase_11 AC 92 ms
71,440 KB
testcase_12 AC 91 ms
71,604 KB
testcase_13 AC 92 ms
71,584 KB
testcase_14 AC 93 ms
71,584 KB
testcase_15 AC 93 ms
71,292 KB
testcase_16 AC 92 ms
71,496 KB
testcase_17 AC 90 ms
71,616 KB
testcase_18 AC 92 ms
71,440 KB
testcase_19 AC 92 ms
71,292 KB
testcase_20 AC 94 ms
71,400 KB
testcase_21 AC 92 ms
71,568 KB
testcase_22 AC 94 ms
71,440 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import *

def trump(n):
    if n == "A":
        return 1
    elif n =="T":
        return 10
    elif n == "J":
        return 11
    elif n == "Q":
        return 12
    elif n == "K":
        return 13
    else:
        return int(n)

N = int(input())
card = list(input().split())
D = defaultdict(list)
DD = dict()
for s in card:
    DD[trump(s[1])] = s[1]
    D[s[0]].append(trump(s[1]))
    
ans = []
for a in sorted(D["D"]):
    ans.append("D" + DD[a])
for a in sorted(D["C"]):
    ans.append("C" + DD[a])
for a in sorted(D["H"]):
    ans.append("H" + DD[a])
for a in sorted(D["S"]):
    ans.append("S" + DD[a])
print(*ans)
0