結果

問題 No.267 トランプソート
ユーザー むらためむらため
提出日時 2019-01-19 09:01:09
言語 Nim
(2.0.2)
結果
AC  
実行時間 2 ms / 1,000 ms
コード長 565 bytes
コンパイル時間 3,494 ms
コンパイル使用メモリ 68,904 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-14 02:15:59
合計ジャッジ時間 4,075 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 AC 2 ms
4,376 KB
testcase_05 AC 1 ms
4,376 KB
testcase_06 AC 2 ms
4,380 KB
testcase_07 AC 2 ms
4,376 KB
testcase_08 AC 1 ms
4,380 KB
testcase_09 AC 2 ms
4,376 KB
testcase_10 AC 2 ms
4,376 KB
testcase_11 AC 2 ms
4,380 KB
testcase_12 AC 1 ms
4,380 KB
testcase_13 AC 2 ms
4,380 KB
testcase_14 AC 2 ms
4,380 KB
testcase_15 AC 2 ms
4,376 KB
testcase_16 AC 2 ms
4,380 KB
testcase_17 AC 2 ms
4,376 KB
testcase_18 AC 1 ms
4,376 KB
testcase_19 AC 2 ms
4,376 KB
testcase_20 AC 2 ms
4,380 KB
testcase_21 AC 1 ms
4,380 KB
testcase_22 AC 2 ms
4,376 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
/home/judge/data/code/Main.nim(1, 8) Warning: imported and not used: 'sequtils' [UnusedImport]

ソースコード

diff #

import sequtils,strutils,algorithm

proc sortCard(x,y:string):int =
  proc toN(c:char):int =
    if c == 'A' : return 1
    if c == 'T' : return 10
    if c == 'J' : return 11
    if c == 'Q' : return 12
    if c == 'K' : return 13
    return c.ord - '0'.ord
  proc toA(c:char):int =
    if c == 'D': return 0
    if c == 'C': return 1
    if c == 'H': return 2
    if c == 'S': return 3
  if x[0] != y[0]: return x[0].toA() - y[0].toA()
  return x[1].toN() - y[1].toN()

let n = stdin.readLine().parseInt()
echo stdin.readLine().split().sorted(sortCard).join(" ")
0