結果

問題 No.1049 Zero (Exhaust)
ユーザー ikdikd
提出日時 2020-05-09 00:09:19
言語 F#
(F# 4.0)
結果
AC  
実行時間 184 ms / 2,000 ms
コード長 599 bytes
コンパイル時間 2,916 ms
コンパイル使用メモリ 162,484 KB
実行使用メモリ 24,956 KB
最終ジャッジ日時 2023-09-17 03:37:09
合計ジャッジ時間 7,163 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 71 ms
24,776 KB
testcase_01 AC 69 ms
22,820 KB
testcase_02 AC 69 ms
22,776 KB
testcase_03 AC 146 ms
24,872 KB
testcase_04 AC 70 ms
22,916 KB
testcase_05 AC 131 ms
22,824 KB
testcase_06 AC 181 ms
22,888 KB
testcase_07 AC 84 ms
22,820 KB
testcase_08 AC 108 ms
22,720 KB
testcase_09 AC 155 ms
22,912 KB
testcase_10 AC 163 ms
22,912 KB
testcase_11 AC 161 ms
22,820 KB
testcase_12 AC 179 ms
22,736 KB
testcase_13 AC 95 ms
22,836 KB
testcase_14 AC 122 ms
24,956 KB
testcase_15 AC 149 ms
22,796 KB
testcase_16 AC 137 ms
22,840 KB
testcase_17 AC 136 ms
22,820 KB
testcase_18 AC 170 ms
22,916 KB
testcase_19 AC 151 ms
22,796 KB
testcase_20 AC 104 ms
24,832 KB
testcase_21 AC 152 ms
22,804 KB
testcase_22 AC 120 ms
22,768 KB
testcase_23 AC 182 ms
22,740 KB
testcase_24 AC 184 ms
20,848 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