結果
問題 |
No.406 鴨等間隔の法則
|
ユーザー |
|
提出日時 | 2020-06-14 11:56:53 |
言語 | OCaml (5.2.1) |
結果 |
AC
|
実行時間 | 65 ms / 2,000 ms |
コード長 | 345 bytes |
コンパイル時間 | 412 ms |
コンパイル使用メモリ | 21,704 KB |
実行使用メモリ | 6,824 KB |
最終ジャッジ日時 | 2024-10-09 01:04:04 |
合計ジャッジ時間 | 2,652 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 29 |
ソースコード
Scanf.scanf "%d" (fun n -> let x = Array.init n (fun _ -> Scanf.scanf " %d" (fun x -> x)) in Array.sort compare x; let rec loop i = if i = n then "YES" else if x.(i) - x.(i - 1) = x.(i - 1) - x.(i - 2) then loop (i + 1) else "NO" in (if x.(0) = x.(1) then "NO" else loop 2) |> print_endline )