結果

問題 No.2326 Factorial to the Power of Factorial to the...
ユーザー praticapratica
提出日時 2023-05-28 16:41:04
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 409 bytes
コンパイル時間 553 ms
コンパイル使用メモリ 86,852 KB
実行使用メモリ 76,024 KB
最終ジャッジ日時 2023-08-27 14:07:28
合計ジャッジ時間 3,279 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 72 ms
75,760 KB
testcase_01 WA -
testcase_02 AC 68 ms
75,380 KB
testcase_03 AC 69 ms
75,336 KB
testcase_04 WA -
testcase_05 AC 70 ms
75,768 KB
testcase_06 AC 72 ms
75,600 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 73 ms
75,508 KB
testcase_11 AC 74 ms
75,488 KB
testcase_12 AC 73 ms
75,516 KB
testcase_13 WA -
testcase_14 AC 74 ms
75,524 KB
testcase_15 WA -
testcase_16 AC 71 ms
75,624 KB
testcase_17 WA -
testcase_18 WA -
testcase_19 AC 69 ms
75,716 KB
testcase_20 AC 64 ms
70,620 KB
testcase_21 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

mod = 10**9 + 7

def power(a, b, m):
    p = a
    Answer = 1
    for i in range(1000):
        if (b>>i)&1:
            Answer = (Answer*p) % m
        p = (p*p) % m
    return Answer

N,P =map(int,input().split())
cnt = 1
for i in range(1,N+1):
    cnt *= i
    cnt %= mod

num = 0
for n in range(1,N+1):

    i = P
    while i <= n:
        num += n//i
        i *= P
    
print(num*power(cnt,cnt,mod)%mod)
0