結果

問題 No.2326 Factorial to the Power of Factorial to the...
ユーザー 094
提出日時 2023-05-28 14:30:05
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 293 bytes
コンパイル時間 156 ms
コンパイル使用メモリ 82,492 KB
実行使用メモリ 60,100 KB
最終ジャッジ日時 2024-12-27 01:40:51
合計ジャッジ時間 1,808 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 11 WA * 9
権限があれば一括ダウンロードができます

ソースコード

diff #

n, p = map(int, input().split())
nfact_cnt = 0
tmp = n


while tmp > 0:
	nfact_cnt += tmp // p
	tmp = tmp // p

MOD = 10**9 + 7
N = 10**5 + 1010

fact = [1]*(N+1)
r = 1
for i in range(1, N+1):
    fact[i] = r = r * i % MOD

nfact = fact[n]

print(
	(nfact_cnt * pow(nfact, nfact, MOD)) % MOD
)
0