結果
| 問題 | No.2326 Factorial to the Power of Factorial to the... |
| コンテスト | |
| ユーザー |
sepa38
|
| 提出日時 | 2023-05-05 21:08:25 |
| 言語 | PyPy3 (7.3.17) |
| 結果 |
AC
|
| 実行時間 | 29 ms / 2,000 ms |
| コード長 | 295 bytes |
| 記録 | |
| コンパイル時間 | 230 ms |
| コンパイル使用メモリ | 84,864 KB |
| 実行使用メモリ | 58,368 KB |
| 最終ジャッジ日時 | 2026-05-17 02:46:22 |
| 合計ジャッジ時間 | 2,133 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 20 |
ソースコード
# fpfpf
n, p = map(int, input().split())
mod = 10 ** 9 + 7
m = 0
for i in range(1, 20):
if n // pow(p, i) == 0:
break
m += n // pow(p, i)
fac0 = 1
fac1 = 1
for i in range(n):
fac0 *= i + 1
fac0 %= mod
fac1 *= i + 1
fac1 %= mod - 1
ans = m * pow(fac0, fac1, mod) % mod
print(ans)
sepa38