結果
問題 | No.954 Result |
ユーザー |
![]() |
提出日時 | 2019-12-18 10:12:00 |
言語 | F# (F# 4.0) |
結果 |
WA
(最新)
AC
(最初)
|
実行時間 | - |
コード長 | 1,141 bytes |
コンパイル時間 | 13,367 ms |
コンパイル使用メモリ | 186,288 KB |
実行使用メモリ | 35,728 KB |
最終ジャッジ日時 | 2024-07-07 01:32:36 |
合計ジャッジ時間 | 25,395 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 7 |
other | AC * 25 WA * 4 |
コンパイルメッセージ
復元対象のプロジェクトを決定しています... /home/judge/data/code/main.fsproj を復元しました (243 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/
ソースコード
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