結果

問題 No.99 ジャンピング駒
ユーザー xsdxsd
提出日時 2020-06-21 02:15:46
言語 OCaml
(5.1.0)
結果
AC  
実行時間 34 ms / 5,000 ms
コード長 346 bytes
コンパイル時間 268 ms
コンパイル使用メモリ 21,444 KB
実行使用メモリ 6,528 KB
最終ジャッジ日時 2024-04-17 09:01:26
合計ジャッジ時間 1,048 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 31 ms
6,528 KB
testcase_01 AC 34 ms
6,528 KB
testcase_02 AC 34 ms
6,528 KB
testcase_03 AC 31 ms
6,400 KB
testcase_04 AC 31 ms
6,528 KB
testcase_05 AC 30 ms
6,528 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

Scanf.scanf "%d" (fun n ->
    let x = Array.init n (fun _ -> Scanf.scanf " %d" (fun x -> x)) in
    let rec loop i ev od =
        if i = n then n - min ev od * 2 else
            if abs x.(i) mod 2 = 0 then loop (i + 1) (ev + 1) od
                                   else loop (i + 1) ev (od + 1)
    in
    loop 0 0 0 |> Printf.printf "%d\n"
)
0