結果

問題 No.2326 Factorial to the Power of Factorial to the...
ユーザー koncha
提出日時 2023-05-28 14:40:15
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 262 bytes
コンパイル時間 1,284 ms
コンパイル使用メモリ 81,664 KB
実行使用メモリ 57,856 KB
最終ジャッジ日時 2024-12-27 02:23:41
合計ジャッジ時間 6,023 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 11 WA * 9
権限があれば一括ダウンロードができます

ソースコード

diff #

N, P = map(int, input().split())

MOD = 10**9 + 7
count = 0
now = 1

total = 1
for i in range(1, N+1):
    total *= i
    total %= MOD

total = pow(total, total, MOD)

while P**now <= N:
    count += N // (P**now)
    now += 1

count *= total
print(count % MOD)
0