結果

問題 No.191 供託金
ユーザー ichibanshibori
提出日時 2017-05-13 17:43:34
言語 OCaml
(5.2.1)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 541 bytes
コンパイル時間 307 ms
コンパイル使用メモリ 19,692 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-10-09 00:00:56
合計ジャッジ時間 1,405 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 23
権限があれば一括ダウンロードができます

ソースコード

diff #

let solve n c_lst =
  let c_sum = List.fold_left (fun s c -> s + c) 0 c_lst in
  let th = c_sum / 10 in

  let rec solve' lst result =
    match lst with
    | [] -> result
    | x::xs ->
      let result = if x <= th then result + 1 else result in
      solve' xs result
  in
  solve' c_lst 0
  |> fun r -> r * 30

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