結果
| 問題 |
No.267 トランプソート
|
| コンテスト | |
| ユーザー |
r_ishida
|
| 提出日時 | 2025-06-16 23:24:02 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
AC
|
| 実行時間 | 34 ms / 1,000 ms |
| コード長 | 1,336 bytes |
| コンパイル時間 | 242 ms |
| コンパイル使用メモリ | 12,544 KB |
| 実行使用メモリ | 10,752 KB |
| 最終ジャッジ日時 | 2025-06-16 23:24:05 |
| 合計ジャッジ時間 | 2,334 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 20 |
ソースコード
import math
import sys
def S(): return sys.stdin.readline().rstrip()
def I(): return int(sys.stdin.readline().rstrip())
def MI(): return map(int, sys.stdin.readline().rstrip().split())
def LI(): return list(map(int, sys.stdin.readline().rstrip().split()))
def LS(): return list(sys.stdin.readline().rstrip().split())
n = I()
m = LS()
k = []
for i in range(n):
num = ""
s = m[i]
if s[0] == 'D':
num += '0'
elif s[0] == 'C':
num += '1'
elif s[0] == 'H':
num += '2'
elif s[0] == 'S':
num += '3'
if s[1] == 'A':
num += '01'
elif s[1] == 'T':
num += '10'
elif s[1] == 'J':
num += '11'
elif s[1] == 'Q':
num += '12'
elif s[1] == 'K':
num += '13'
else:
num += '0'+s[1]
k.append(num)
k.sort()
ans = []
for i in range(n):
num = k[i]
if num[0] == '0':
suit = 'D'
elif num[0] == '1':
suit = 'C'
elif num[0] == '2':
suit = 'H'
elif num[0] == '3':
suit = 'S'
if num[1:] == '01':
rank = 'A'
elif num[1:] == '10':
rank = 'T'
elif num[1:] == '11':
rank = 'J'
elif num[1:] == '12':
rank = 'Q'
elif num[1:] == '13':
rank = 'K'
else:
rank = num[2]
ans.append(suit+rank)
print(' '.join(ans))
r_ishida