結果

問題 No.1049 Zero (Exhaust)
ユーザー ikdikd
提出日時 2020-05-09 00:44:15
言語 F#
(F# 4.0)
結果
AC  
実行時間 215 ms / 2,000 ms
コード長 593 bytes
コンパイル時間 4,709 ms
コンパイル使用メモリ 166,672 KB
実行使用メモリ 24,900 KB
最終ジャッジ日時 2023-09-17 04:33:52
合計ジャッジ時間 10,181 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 83 ms
22,908 KB
testcase_01 AC 83 ms
22,728 KB
testcase_02 AC 83 ms
24,872 KB
testcase_03 AC 173 ms
22,756 KB
testcase_04 AC 83 ms
22,736 KB
testcase_05 AC 158 ms
24,888 KB
testcase_06 AC 215 ms
22,912 KB
testcase_07 AC 99 ms
22,792 KB
testcase_08 AC 122 ms
22,700 KB
testcase_09 AC 183 ms
24,808 KB
testcase_10 AC 191 ms
22,988 KB
testcase_11 AC 193 ms
24,884 KB
testcase_12 AC 211 ms
24,812 KB
testcase_13 AC 112 ms
22,756 KB
testcase_14 AC 139 ms
22,736 KB
testcase_15 AC 177 ms
24,900 KB
testcase_16 AC 158 ms
22,792 KB
testcase_17 AC 161 ms
22,832 KB
testcase_18 AC 192 ms
20,760 KB
testcase_19 AC 175 ms
24,752 KB
testcase_20 AC 121 ms
22,788 KB
testcase_21 AC 179 ms
24,740 KB
testcase_22 AC 137 ms
20,836 KB
testcase_23 AC 215 ms
22,908 KB
testcase_24 AC 214 ms
22,792 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(13,9): warning FS0025: Incomplete pattern matches on this expression. For example, the value '[|_; _; _|]' may indicate a case not covered by the pattern(s).

ソースコード

diff #

// Learn more about F# at http://fsharp.org

open System

let MOD = 1000000007L

let inline (+%) x y = (x + y) % MOD
let inline (-%) x y = (x - y + MOD) % MOD
let inline (%*) x y = (x * y) % MOD

[<EntryPoint>]
let main argv =
    let [| p; k |] = stdin.ReadLine().Split() |> Array.map int64

    let rec solve i dp0 dp1 =
        if i = k then
            dp0
        else
            let s = dp0 +% dp1 %* (p -% 1L)
            solve (i + 1L) (s +% dp0 %* p +% dp1 %* (p -% 1L)) (s +% dp1 %* (p -% 1L))

    let ans = solve 0L 1L 0L
    printfn "%d" ans
    0 // return an integer exit code
0