結果
問題 |
No.1109 調の判定
|
ユーザー |
|
提出日時 | 2020-09-09 12:27:22 |
言語 | OCaml (5.2.1) |
結果 |
WA
|
実行時間 | - |
コード長 | 453 bytes |
コンパイル時間 | 422 ms |
コンパイル使用メモリ | 21,704 KB |
実行使用メモリ | 6,824 KB |
最終ジャッジ日時 | 2024-10-09 02:03:31 |
合計ジャッジ時間 | 2,011 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 32 WA * 11 |
ソースコード
let () = Scanf.scanf "%d\n" @@ fun n -> let t = Array.init n @@ fun _ -> Scanf.scanf "%d " @@ fun d -> d in let check d x = if List.mem ((x-d+12) mod 12) [0;2;4;5;7;9;11] then true else false in let num = ref [] in for i = 0 to n - 1 do let d = t.(i) in let b = Array.fold_left (fun b x -> b && (check d x)) true t in if b then num := d :: !num done; Printf.printf "%d\n" (if List.length !num = 1 then List.hd !num else -1)