結果
問題 | No.267 トランプソート |
ユーザー |
|
提出日時 | 2016-06-17 20:38:27 |
言語 | Haskell (9.10.1) |
結果 |
AC
|
実行時間 | 3 ms / 1,000 ms |
コード長 | 753 bytes |
コンパイル時間 | 2,476 ms |
コンパイル使用メモリ | 177,204 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-10-09 16:57:58 |
合計ジャッジ時間 | 3,380 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 20 |
コンパイルメッセージ
Loaded package environment from /home/judge/.ghc/x86_64-linux-9.8.2/environments/default [1 of 2] Compiling Main ( Main.hs, Main.o ) Main.hs:13:1: warning: [GHC-94817] [-Wtabs] Tab character found here, and in 8 further locations. Suggested fix: Please use spaces instead. | 13 | | and (map isDigit str) = read str | ^^^^^^^^ [2 of 2] Linking a.out
ソースコード
importData.ListsortByimportData.CharisDigitdata Mark = D | C | H | S derivingShowEnumReadtoNum::String->InttoNum "A" = 1toNum "T" = 10toNum "J" = 11toNum "Q" = 12toNum "K" = 13toNum str| and (map isDigit str) = read str| otherwise = 0fromNum::Int->StringfromNum 1 = "A"fromNum 10 = "T"fromNum 11 = "J"fromNum 12 = "Q"fromNum 13 = "K"fromNum x = show xcomp::MarkInt->MarkInt->Orderingcomp (ma, a) (mb, b)| c /= EQ = c| otherwise = compare a bwhere c = compare (fromEnum ma) (fromEnum mb)main = dogetLinecards <- return . unwords . map (\(m, n) -> show m ++ fromNum n) . sortBy comp . map ((\(m, n) -> (read m :: Mark, toNum n)) . (splitAt 1)) .words =<< getLineputStrLn cards