結果

問題 No.9008 空白区切りで与えられる数値データの合計値を求める(テスト用)
ユーザー r6ever6eve
提出日時 2017-08-09 12:02:32
言語 OCaml
(5.1.0)
結果
WA  
実行時間 -
コード長 533 bytes
コンパイル時間 320 ms
コンパイル使用メモリ 20,992 KB
実行使用メモリ 37,156 KB
最終ジャッジ日時 2024-04-17 08:37:48
合計ジャッジ時間 1,854 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 1 ms
5,376 KB
testcase_03 AC 2 ms
5,376 KB
testcase_04 WA -
testcase_05 AC 2 ms
5,376 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 AC 15 ms
9,856 KB
testcase_09 AC 23 ms
11,960 KB
testcase_10 AC 93 ms
30,688 KB
testcase_11 AC 93 ms
30,324 KB
testcase_12 AC 92 ms
29,960 KB
testcase_13 AC 95 ms
32,028 KB
testcase_14 AC 93 ms
32,688 KB
testcase_15 AC 97 ms
32,832 KB
testcase_16 AC 111 ms
37,156 KB
testcase_17 AC 2 ms
5,376 KB
testcase_18 RE -
権限があれば一括ダウンロードができます

ソースコード

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