結果

問題 No.116 門松列(1)
ユーザー regeregeregerege
提出日時 2016-06-15 23:38:39
言語 F#
(F# 4.0)
結果
AC  
実行時間 94 ms / 5,000 ms
コード長 354 bytes
コンパイル時間 4,372 ms
コンパイル使用メモリ 158,572 KB
実行使用メモリ 25,220 KB
最終ジャッジ日時 2023-09-07 06:58:31
合計ジャッジ時間 7,689 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 89 ms
23,176 KB
testcase_01 AC 92 ms
25,092 KB
testcase_02 AC 91 ms
21,000 KB
testcase_03 AC 93 ms
25,148 KB
testcase_04 AC 82 ms
23,072 KB
testcase_05 AC 88 ms
25,108 KB
testcase_06 AC 87 ms
23,188 KB
testcase_07 AC 90 ms
23,212 KB
testcase_08 AC 90 ms
23,096 KB
testcase_09 AC 91 ms
23,032 KB
testcase_10 AC 91 ms
23,036 KB
testcase_11 AC 91 ms
23,032 KB
testcase_12 AC 92 ms
25,096 KB
testcase_13 AC 91 ms
23,100 KB
testcase_14 AC 91 ms
23,120 KB
testcase_15 AC 90 ms
23,156 KB
testcase_16 AC 92 ms
25,220 KB
testcase_17 AC 91 ms
25,164 KB
testcase_18 AC 94 ms
23,040 KB
testcase_19 AC 92 ms
23,044 KB
testcase_20 AC 91 ms
23,100 KB
testcase_21 AC 88 ms
23,112 KB
testcase_22 AC 90 ms
25,080 KB
testcase_23 AC 88 ms
23,112 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) F# Compiler version 11.0.0.0 for F# 5.0
Copyright (c) Microsoft Corporation. All Rights Reserved.

ソースコード

diff #

let _ = stdin.ReadLine()
let l = stdin.ReadLine().Split(' ') |> Seq.map int |> Seq.toList
let rec check a b c =
    (a <> b && b <> c && a <> c)
    && ((a > b && b < c) || (a < b && b > c))
let rec f cnt = function
    | a::b::c::xs ->
        let cnt = if check a b c then cnt + 1 else cnt
        f cnt ([b;c]@xs)
    | _ -> cnt
f 0 l
|> printfn "%d"
0