結果
問題 | No.123 カードシャッフル |
ユーザー |
![]() |
提出日時 | 2019-09-14 02:13:35 |
言語 | Haskell (9.10.1) |
結果 |
AC
|
実行時間 | 11 ms / 5,000 ms |
コード長 | 704 bytes |
コンパイル時間 | 6,480 ms |
コンパイル使用メモリ | 181,020 KB |
実行使用メモリ | 11,264 KB |
最終ジャッジ日時 | 2024-07-04 15:43:41 |
合計ジャッジ時間 | 6,364 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 10 |
コンパイルメッセージ
Loaded package environment from /home/judge/.ghc/x86_64-linux-9.8.2/environments/default [1 of 2] Compiling Main ( Main.hs, Main.o ) [2 of 2] Linking a.out
ソースコード
importControl.Applicative(<$>)importData.CharisSpaceimportData.ByteString.CharByteStringimportqualifiedData.ByteString.CharasBimportData.Listfoldl',unfoldrgetL::ByteString->Int->IOIntgetL f = f <$> B.getLinereadIL::ByteString->MaybeIntByteString->ByteString->IntreadIL f = unfoldr gwhereg s = do(n, s') <- f sreturn (n, B.dropWhile isSpace s')main::IO()main = doB.getLineas <- reverse <$> getL (readIL B.readInt)print $ foldl' f 1 aswheref::Int->Int->Intf acc n | acc == 1 = n| acc <= n = acc - 1| otherwise = acc