結果

問題 No.267 トランプソート
ユーザー けむけむけむけむ
提出日時 2021-08-24 18:35:28
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 29 ms / 1,000 ms
コード長 1,201 bytes
コンパイル時間 419 ms
コンパイル使用メモリ 12,800 KB
実行使用メモリ 10,880 KB
最終ジャッジ日時 2024-04-27 05:53:56
合計ジャッジ時間 1,778 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

def cards(N, cs):
    D = []
    C = []
    H = []
    S = []
    for i in range(N):
        m = cs[i][0]
        n = cs[i][1]
        n = henkan(n)
        if m == 'D':
            D.append(n)
        elif m == 'C':
            C.append(n)
        elif m == 'H':
            H.append(n)
        elif m == 'S':
            S.append(n)
    D = sorted(D)
    C = sorted(C)
    H = sorted(H)
    S = sorted(S)
    ans = ''
    for d in D:
        ans += 'D' + str((henkan(d))) + ' '
    for c in C:
        ans += 'C' + str(henkan(c)) + ' '
    for h in H:
        ans += 'H' + str(henkan(h)) + ' '
    for s in S:
        ans += 'S' + str(henkan(s)) + ' '
    return ans

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

def main():
    N = int(input())
    cs = list(map(str, input().split()))
    print(cards(N, cs))

if __name__ == '__main__':
    main()
0