結果

問題 No.358 も~っと!門松列
ユーザー xsd
提出日時 2020-06-20 18:32:58
言語 OCaml
(5.2.1)
結果
AC  
実行時間 2 ms / 1,000 ms
コード長 432 bytes
コンパイル時間 466 ms
コンパイル使用メモリ 21,576 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-10-09 01:31:37
合計ジャッジ時間 1,115 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 23
権限があれば一括ダウンロードができます

ソースコード

diff #

Scanf.scanf "%d %d %d"(fun a1 a2 a3 ->
    let iskado b1 b2 b3 =
        (b2 < b1 && b2 < b3 && b1 <> b3) ||
        (b2 > b1 && b2 > b3 && b1 <> b3)
    in
    let rec count i acc =
        if i = 0 then acc else
            count (i - 1) (if iskado (a1 mod i) (a2 mod i) (a3 mod i) then acc + 1 else acc)
    in
    if iskado a1 a2 a3 then print_endline "INF" else
           Printf.printf "%d\n" @@ count (max a1 (max a2 a3)) 0
)
0