結果

問題 No.1047 Zero (Novice)
ユーザー ikdikd
提出日時 2020-06-06 21:47:10
言語 F#
(F# 4.0)
結果
AC  
実行時間 89 ms / 2,000 ms
コード長 414 bytes
コンパイル時間 3,506 ms
コンパイル使用メモリ 165,648 KB
実行使用メモリ 25,124 KB
最終ジャッジ日時 2023-08-25 02:02:25
合計ジャッジ時間 6,886 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 88 ms
20,960 KB
testcase_01 AC 74 ms
22,552 KB
testcase_02 AC 89 ms
23,064 KB
testcase_03 AC 74 ms
20,632 KB
testcase_04 AC 73 ms
22,680 KB
testcase_05 AC 76 ms
22,600 KB
testcase_06 AC 88 ms
25,068 KB
testcase_07 AC 71 ms
22,716 KB
testcase_08 AC 87 ms
23,176 KB
testcase_09 AC 88 ms
23,072 KB
testcase_10 AC 73 ms
24,660 KB
testcase_11 AC 72 ms
22,736 KB
testcase_12 AC 74 ms
24,740 KB
testcase_13 AC 72 ms
24,692 KB
testcase_14 AC 72 ms
24,728 KB
testcase_15 AC 74 ms
24,616 KB
testcase_16 AC 73 ms
20,672 KB
testcase_17 AC 73 ms
22,640 KB
testcase_18 AC 87 ms
25,124 KB
testcase_19 AC 74 ms
22,684 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) F# Compiler version 11.0.0.0 for F# 5.0
Copyright (c) Microsoft Corporation. All Rights Reserved.

/home/judge/data/code/Main.fs(5,9): warning FS0025: Incomplete pattern matches on this expression. For example, the value '[|_; _; _|]' may indicate a case not covered by the pattern(s).

ソースコード

diff #

open System

[<EntryPoint>]
let main _ =
    let [| a; b |] = stdin.ReadLine().Split(' ') |> Array.map int64

    let s =
        (0L, 0)
        |> Seq.unfold (fun (n, i) ->
            if abs i >= 3 then None else Some(n, (a * n + b, i + 1)))

    let i =
        s
        |> Seq.tail
        |> Seq.tryFindIndex ((=) 0L)

    match i with
    | Some i -> printfn "%d" <| i + 1
    | None -> printfn "-1"
    0
0