結果
問題 |
No.123 カードシャッフル
|
ユーザー |
![]() |
提出日時 | 2017-08-10 18:35:29 |
言語 | OCaml (5.2.1) |
結果 |
AC
|
実行時間 | 24 ms / 5,000 ms |
コード長 | 332 bytes |
コンパイル時間 | 380 ms |
コンパイル使用メモリ | 21,704 KB |
実行使用メモリ | 8,064 KB |
最終ジャッジ日時 | 2024-10-09 00:09:34 |
合計ジャッジ時間 | 1,057 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 10 |
ソースコード
let () = let m = Scanf.scanf "%d %d " (fun _ m -> m) in let rec read i acc = if i = m then acc else Scanf.scanf "%d " (fun i -> i) :: acc |> read (i + 1) in let rec doit x = function | [] -> x | a :: l -> doit (if x = 1 then a else if x > a then x else x - 1) l in read 0 [] |> doit 1 |> Printf.printf "%d\n"