結果

問題 No.9008 空白区切りで与えられる数値データの合計値を求める(テスト用)
ユーザー r6eve
提出日時 2017-08-09 12:02:32
言語 OCaml
(5.2.1)
結果
WA  
実行時間 -
コード長 533 bytes
コンパイル時間 421 ms
コンパイル使用メモリ 20,992 KB
実行使用メモリ 37,156 KB
最終ジャッジ日時 2024-10-09 00:03:51
合計ジャッジ時間 1,838 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 11 WA * 3 RE * 1
権限があれば一括ダウンロードができます

ソースコード

diff #

module IO = struct

  (* @since 4.04.0 *)
  let split_on_char sep s =
    let open String in
    let r = ref [] in
    let j = ref (length s) in
    for i = length s - 1 downto 0 do
      if get s i = sep then begin
        r := sub s (i + 1) (!j - i - 1) :: !r;
        j := i
      end
    done;
    sub s 0 !j :: !r

  let read_ss () = read_line () |> split_on_char ' '

  let read_ns () = read_ss () |> List.map int_of_string

end

let () =
  read_int () |> ignore;
  IO.read_ns () |> List.fold_left (+) 0 |> Printf.printf "%d\n"
0