結果

問題 No.793 うし数列 2
ユーザー 826814741_6826814741_6
提出日時 2019-03-14 17:12:20
言語 F#
(F# 4.0)
結果
AC  
実行時間 83 ms / 2,000 ms
コード長 526 bytes
コンパイル時間 3,348 ms
コンパイル使用メモリ 157,524 KB
実行使用メモリ 24,904 KB
最終ジャッジ日時 2023-09-09 04:21:46
合計ジャッジ時間 6,551 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 83 ms
22,952 KB
testcase_01 AC 81 ms
24,904 KB
testcase_02 AC 82 ms
24,840 KB
testcase_03 AC 81 ms
21,004 KB
testcase_04 AC 81 ms
22,720 KB
testcase_05 AC 81 ms
24,896 KB
testcase_06 AC 81 ms
22,804 KB
testcase_07 AC 81 ms
22,988 KB
testcase_08 AC 80 ms
24,844 KB
testcase_09 AC 82 ms
24,840 KB
testcase_10 AC 81 ms
22,972 KB
testcase_11 AC 81 ms
22,796 KB
testcase_12 AC 81 ms
22,664 KB
testcase_13 AC 81 ms
22,744 KB
testcase_14 AC 81 ms
22,808 KB
testcase_15 AC 82 ms
24,864 KB
testcase_16 AC 82 ms
22,800 KB
testcase_17 AC 81 ms
22,792 KB
testcase_18 AC 81 ms
22,796 KB
testcase_19 AC 82 ms
22,916 KB
testcase_20 AC 82 ms
22,776 KB
testcase_21 AC 82 ms
22,884 KB
testcase_22 AC 82 ms
22,756 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) F# Compiler version 11.0.0.0 for F# 5.0
Copyright (c) Microsoft Corporation. All Rights Reserved.

ソースコード

diff #

let inline isOdd n = n&&&LanguagePrimitives.GenericOne=LanguagePrimitives.GenericOne
let inline isGt0 n = n>LanguagePrimitives.GenericZero
let inline rShift1 n = n>>>LanguagePrimitives.GenericOne

let inline genPow m =
    let f n p r = if isOdd p then r*n%m else r
    let rec g n p r = if isGt0 p then g (n*n%m) (rShift1 p) (f n p r) else r
    fun n p -> g n p LanguagePrimitives.GenericOne

let N,D = stdin.ReadLine()|>int64,1000000007L
let pow = genPow D

((pow 10L N) * 4L % D - 1L) * (pow 3L (D-2L)) % D |> printfn "%d"
0