結果

問題 No.143 豆
ユーザー ichibanshibori
提出日時 2016-10-09 01:28:49
言語 OCaml
(5.2.1)
結果
AC  
実行時間 2 ms / 1,000 ms
コード長 397 bytes
コンパイル時間 398 ms
コンパイル使用メモリ 19,692 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-10-08 23:51:46
合計ジャッジ時間 814 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 17
権限があれば一括ダウンロードができます

ソースコード

diff #

let () =
  let k, n = read_line () |> Str.split (Str.regexp_string " ") |>
             List.map int_of_string |>
             fun lst -> (List.nth lst 0, List.nth lst 1)
  and alst = read_line () |> Str.split (Str.regexp_string " ") |>
             List.map int_of_string
  in
  let ans = (k * n) - (List.fold_left ( + ) 0 alst) in
  (if ans < 0 then -1 else ans) |> print_int;
  print_newline ()
0