結果

問題 No.2326 Factorial to the Power of Factorial to the...
コンテスト
ユーザー koncha
提出日時 2023-05-28 14:40:15
言語 PyPy3
(7.3.17)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
WA  
実行時間 -
コード長 262 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 1,337 ms
コンパイル使用メモリ 85,504 KB
実行使用メモリ 58,240 KB
最終ジャッジ日時 2026-06-01 20:04:20
合計ジャッジ時間 2,246 ms
ジャッジサーバーID
(参考情報)
judge2_0 / judge3_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 11 WA * 9
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

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