結果
| 問題 |
No.267 トランプソート
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2019-01-19 09:01:09 |
| 言語 | Nim (2.2.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 1,000 ms |
| コード長 | 565 bytes |
| コンパイル時間 | 3,381 ms |
| コンパイル使用メモリ | 65,576 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-07-01 10:20:06 |
| 合計ジャッジ時間 | 4,255 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 20 |
コンパイルメッセージ
/home/judge/data/code/Main.nim(1, 8) Warning: imported and not used: 'sequtils' [UnusedImport]
ソースコード
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(" ")