結果

問題 No.2326 Factorial to the Power of Factorial to the...
ユーザー aaaaaaaaaa2230
提出日時 2023-05-28 15:08:16
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 285 bytes
コンパイル時間 2,284 ms
コンパイル使用メモリ 81,460 KB
実行使用メモリ 60,344 KB
最終ジャッジ日時 2024-12-27 04:50:30
合計ジャッジ時間 4,813 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 11 WA * 9
権限があれば一括ダウンロードができます

ソースコード

diff #

n,p = map(int,input().split())
mod = 10**9+7

if n < p:
    print(0)
    exit()

num = 0
facts = 1
for i in range(1,n+1):
    now = i
    while now%p == 0:
        now //= p
        num += 1
    
    facts *= i
    facts %= mod
po = pow(facts,facts,mod)
ans = num * po % mod
print(ans)
0