結果

問題 No.954 Result
コンテスト
ユーザー guricerin
提出日時 2019-12-18 10:05:54
言語 F#
(F# 10.0)
コンパイル:
fsharp_c _filename_
実行:
/usr/bin/dotnet_wrap
結果
WA  
実行時間 -
コード長 1,018 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 12,259 ms
コンパイル使用メモリ 201,856 KB
実行使用メモリ 37,604 KB
最終ジャッジ日時 2026-03-27 08:32:41
合計ジャッジ時間 21,304 ms
ジャッジサーバーID
(参考情報)
judge1_0 / judge3_1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 5 WA * 2
other AC * 24 WA * 5
権限があれば一括ダウンロードができます
コンパイルメッセージ
  復元対象のプロジェクトを決定しています...
  /home/judge/data/code/main.fsproj を復元しました (176 ミリ秒)。
  main -> /home/judge/data/code/bin/Release/net10.0/main.dll
  main -> /home/judge/data/code/bin/Release/net10.0/publish/

ソースコード

diff #
raw source code

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 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

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