結果

問題 No.267 トランプソート
ユーザー takakin
提出日時 2020-04-30 22:21:17
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 31 ms / 1,000 ms
コード長 491 bytes
コンパイル時間 115 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 10,752 KB
最終ジャッジ日時 2024-12-17 19:41:48
合計ジャッジ時間 1,765 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 20
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input=lambda: sys.stdin.readline().rstrip()
n=int(input())
A=[str(i) for i in input().split()]
B=[]
for a in A:
  num=0
  if a[0]=="C":
    num+=100
  elif a[0]=="H":
    num+=200
  elif a[0]=="S":
    num+=300
  if a[1]=="T":
    num+=10
  elif a[1]=="J":
    num+=11
  elif a[1]=="Q":
    num+=12
  elif a[1]=="K":
    num+=13
  elif a[1]=="A":
    num+=1
  else:
    num+=int(a[1])
  B.append((num,a))
B.sort(key=lambda x:x[0])
Ans=[]
for b in B:
  Ans.append(b[1])
print(*Ans)
0