結果

問題 No.954 Result
ユーザー guriceringuricerin
提出日時 2019-12-18 10:12:00
言語 F#
(F# 4.0)
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 1,141 bytes
コンパイル時間 6,976 ms
コンパイル使用メモリ 165,504 KB
実行使用メモリ 26,440 KB
最終ジャッジ日時 2023-09-21 07:06:06
合計ジャッジ時間 9,575 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 86 ms
26,264 KB
testcase_01 AC 86 ms
24,244 KB
testcase_02 AC 84 ms
22,052 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 86 ms
24,328 KB
testcase_08 AC 85 ms
24,096 KB
testcase_09 AC 86 ms
24,180 KB
testcase_10 AC 85 ms
24,264 KB
testcase_11 AC 86 ms
24,312 KB
testcase_12 AC 85 ms
26,184 KB
testcase_13 AC 85 ms
24,272 KB
testcase_14 AC 85 ms
24,296 KB
testcase_15 AC 86 ms
24,244 KB
testcase_16 AC 85 ms
26,252 KB
testcase_17 AC 92 ms
22,288 KB
testcase_18 AC 87 ms
24,228 KB
testcase_19 AC 86 ms
24,156 KB
testcase_20 AC 86 ms
24,472 KB
testcase_21 AC 87 ms
24,156 KB
testcase_22 AC 86 ms
26,252 KB
testcase_23 AC 85 ms
22,204 KB
testcase_24 AC 86 ms
24,164 KB
testcase_25 AC 86 ms
24,324 KB
testcase_26 AC 85 ms
24,324 KB
testcase_27 AC 85 ms
26,440 KB
testcase_28 AC 85 ms
24,216 KB
testcase_29 AC 85 ms
26,292 KB
testcase_30 AC 84 ms
24,336 KB
testcase_31 AC 86 ms
24,364 KB
testcase_32 AC 85 ms
26,208 KB
testcase_33 AC 86 ms
24,324 KB
testcase_34 AC 85 ms
26,316 KB
testcase_35 AC 85 ms
24,284 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) F# Compiler version 11.0.0.0 for F# 5.0
Copyright (c) Microsoft Corporation. All Rights Reserved.

ソースコード

diff #

open System
open System.Collections.Generic

[<AutoOpen>]
module Cin =
    let read f = stdin.ReadLine() |> f
    let reada f = stdin.ReadLine().Split() |> Array.map f

    let readInts() =
        read string
        |> Seq.toArray
        |> Array.map (fun x -> Convert.ToInt32(x.ToString()))

module Util =
    let strRev s =
        s
        |> Seq.rev
        |> Seq.map string
        |> String.concat ""

[<EntryPoint>]
let main _ =
    let A = Array.zeroCreate 5
    for i in 0 .. 4 do
        A.[i] <- read int64

    let mutable fib = new SortedSet<int64>()
    let mutable a = 0L
    let mutable b = 1L
    while a <= int64 1e15 do
        fib.Add(a) |> ignore
        fib.Add(b) |> ignore
        a <- a + b
        b <- b + a

    let f n =
        printfn "%d" n
        exit (0)

    let mutable ans = 0
    if fib.Contains(A.[4]) then
        ans <- 1
        for i in 4 .. -1 .. 1 do
            let a = A.[i]
            let b = A.[i - 1]
            if a <= b && fib.Contains(a) && fib.Contains(b) then ans <- ans + 1
            else f ans
    else
        f 0

    printfn "%d" ans
    0 // return an integer exit code
0