結果

問題 No.99 ジャンピング駒
ユーザー ichibanshiboriichibanshibori
提出日時 2016-12-12 02:46:47
言語 OCaml
(5.1.0)
結果
AC  
実行時間 38 ms / 5,000 ms
コード長 392 bytes
コンパイル時間 186 ms
コンパイル使用メモリ 19,692 KB
実行使用メモリ 16,376 KB
最終ジャッジ日時 2024-04-17 08:35:36
合計ジャッジ時間 1,294 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 37 ms
15,232 KB
testcase_01 AC 36 ms
15,356 KB
testcase_02 AC 36 ms
15,356 KB
testcase_03 AC 38 ms
15,356 KB
testcase_04 AC 37 ms
16,376 KB
testcase_05 AC 32 ms
13,308 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

let solve lst =
  let len_lst = List.length lst
  and even_num = List.filter (fun n -> n mod 2 = 0) lst |> List.length
  in
  let odd_num = len_lst - even_num in
  abs (even_num - odd_num)

let () =
  let _ = read_line ()
  and x_lst = read_line () |>
              Str.split (Str.regexp_string " ") |>
              List.map int_of_string
  in
  solve x_lst |> string_of_int |> print_endline
0