結果

問題 No.267 トランプソート
ユーザー HIROPON87069639HIROPON87069639
提出日時 2016-02-17 22:38:46
言語 Python2
(2.7.18)
結果
AC  
実行時間 12 ms / 1,000 ms
コード長 1,487 bytes
コンパイル時間 58 ms
コンパイル使用メモリ 7,068 KB
実行使用メモリ 6,464 KB
最終ジャッジ日時 2023-10-22 06:26:05
合計ジャッジ時間 1,427 ms
ジャッジサーバーID
(参考情報)
judge15 / judge9
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

# -*- coding: utf-8 -*-
def ch(card):
    card1 = card.replace("A", "1")
    card2 = card1.replace("T", "10")
    card3 = card2.replace("J", "11")
    card4 = card3.replace("Q", "12")
    card5 = card4.replace("K", "13")
    if "D" in card5:
        card5 = card5.lstrip("D")
        card5 = card5.rjust(2, "0")
        card6 = int(card5) + 100
        return card6
    elif "C" in card5:
        card5 = card5.lstrip("C")
        card5 = card5.rjust(2, "0")
        card6 = int(card5) + 200
        return card6
    elif "H" in card5:
        card5 = card5.lstrip("H")
        card5 = card5.rjust(2, "0")
        card6 = int(card5) + 300
        return card6
    else:
        card5 = card5.lstrip("S")
        card5 = card5.rjust(2, "0")
        card6 = int(card5) + 400
        return card6


def rech(card):
    if 100 < card < 200:
        Mk = "D"
        card -= 100
    elif 200 < card < 300:
        Mk = "C"
        card -= 200
    elif 300 < card < 400:
        Mk = "H"
        card -= 300
    elif 400 < card:
        Mk = "S"
        card -= 400
    if card == 1:
        No = "A"
    elif card == 10:
        No = "T"
    elif card == 11:
        No = "J"
    elif card == 12:
        No = "Q"
    elif card == 13:
        No = "K"
    else:
        No = card
    return Mk + str(No)




N = input()
inp = raw_input().split()
inp = map(ch, inp)
inp.sort()
inp = map(rech, inp)
out = ""
for i in range(0, N):
    out += inp[i]
    if i != N-1:
        out += " "
print out
0