結果

問題 No.185 和風
ユーザー r6eve
提出日時 2017-08-11 09:58:55
言語 OCaml
(5.5.2)
コンパイル:
ocamlfind ocamlopt -linkpkg -package zarith,str _filename_ -o a.out
実行:
./a.out
結果
AC  
実行時間 1 ms / 1,000 ms
+ 749µs
コード長 333 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 1,450 ms
コンパイル使用メモリ 22,692 KB
実行使用メモリ 9,908 KB
最終ジャッジ日時 2026-11-12 12:35:40
合計ジャッジ時間 2,708 ms
ジャッジサーバーID
(参考情報)
judge5_0 / judge2_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 10
権限があれば一括ダウンロードができます
コンパイルメッセージ
ocamlfind: [WARNING] Cannot read directory ./stublibs which is mentioned in ld.conf

ソースコード

diff #
raw source code

let () =
  let n = Scanf.scanf "%d " (fun i -> i) in
  let rec doit i z =
    if i = n then z
    else
      let x, y = Scanf.scanf "%d %d " (fun x y -> x, y) in
      if x >= y then (-1)
      else
        let s = y - x in
        if z <> (-1) && z <> s then (-1)
        else doit (i + 1) s in
  doit 0 (-1) |> Printf.printf "%d\n"
0