結果

問題 No.1674 Introduction to XOR
ユーザー xsd
提出日時 2022-07-17 01:24:14
言語 OCaml
(5.2.1)
結果
AC  
実行時間 2 ms / 1,000 ms
コード長 254 bytes
コンパイル時間 236 ms
コンパイル使用メモリ 21,700 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-06-29 02:25:00
合計ジャッジ時間 1,595 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 21
権限があれば一括ダウンロードができます

ソースコード

diff #

Scanf.scanf "%d" (fun n ->
    let a = Array.init n (fun _ -> Scanf.scanf " %d" (fun a -> a)) in
    let ao = Array.fold_left (lor) 0 a in

    let rec loop i =
        if i land ao = 0 then i else loop (i * 2)
    in
    loop 1 |> Printf.printf "%d\n"
)
0