結果

問題 No.358 も~っと!門松列
ユーザー suzukim0702suzukim0702
提出日時 2016-04-27 23:35:40
言語 F#
(F# 4.0)
結果
AC  
実行時間 75 ms / 1,000 ms
コード長 548 bytes
コンパイル時間 9,872 ms
コンパイル使用メモリ 186,268 KB
実行使用メモリ 31,732 KB
最終ジャッジ日時 2024-04-15 04:36:28
合計ジャッジ時間 8,459 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 72 ms
31,232 KB
testcase_01 AC 70 ms
31,360 KB
testcase_02 AC 75 ms
31,232 KB
testcase_03 AC 72 ms
30,720 KB
testcase_04 AC 71 ms
31,360 KB
testcase_05 AC 72 ms
31,600 KB
testcase_06 AC 70 ms
30,848 KB
testcase_07 AC 74 ms
31,232 KB
testcase_08 AC 72 ms
31,732 KB
testcase_09 AC 72 ms
31,488 KB
testcase_10 AC 72 ms
30,720 KB
testcase_11 AC 71 ms
31,104 KB
testcase_12 AC 71 ms
31,608 KB
testcase_13 AC 69 ms
31,104 KB
testcase_14 AC 71 ms
31,232 KB
testcase_15 AC 70 ms
31,104 KB
testcase_16 AC 73 ms
30,976 KB
testcase_17 AC 70 ms
30,976 KB
testcase_18 AC 70 ms
31,232 KB
testcase_19 AC 70 ms
30,976 KB
testcase_20 AC 73 ms
31,488 KB
testcase_21 AC 67 ms
31,104 KB
testcase_22 AC 74 ms
31,616 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
  復元対象のプロジェクトを決定しています...
  /home/judge/data/code/main.fsproj を復元しました (348 ms)。
MSBuild のバージョン 17.9.6+a4ecab324 (.NET)
  main -> /home/judge/data/code/bin/Release/net8.0/main.dll
  main -> /home/judge/data/code/bin/Release/net8.0/publish/

ソースコード

diff #

open System

let isKadomatsu (a1, a2, a3) =
    a1 <> a3 && ((a1 < a2 && a3 < a2) || (a1 > a2 && a3 > a2))

let countKadomatsu (a1, a2, a3) =
    if isKadomatsu (a1, a2, a3) then -1
    else
        let maxA = [a1; a2; a3] |> List.max
        seq {2..maxA} |> Seq.map (fun i -> (a1 % i, a2 % i, a3 % i)) |>
        Seq.filter isKadomatsu |> Seq.length

Console.ReadLine () |> (fun line -> line.Split([| ' ' |])) |> Array.map int |>
(fun arr -> (arr.[0], arr.[1], arr.[2])) |>
countKadomatsu |>
(function -1 -> "INF" | n -> string n) |> printfn "%s"
0