結果
問題 |
No.954 Result
|
ユーザー |
![]() |
提出日時 | 2019-12-18 10:05:54 |
言語 | F# (F# 4.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,018 bytes |
コンパイル時間 | 10,696 ms |
コンパイル使用メモリ | 187,096 KB |
実行使用メモリ | 35,256 KB |
最終ジャッジ日時 | 2024-07-05 22:13:24 |
合計ジャッジ時間 | 24,332 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 5 WA * 2 |
other | AC * 24 WA * 5 |
コンパイルメッセージ
復元対象のプロジェクトを決定しています... /home/judge/data/code/main.fsproj を復元しました (553 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 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