結果
| 問題 | No.2326 Factorial to the Power of Factorial to the... |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2023-05-28 14:30:21 |
| 言語 | PyPy3 (8.0.0 + ACL) |
| 結果 |
AC
不安定
|
| 実行時間 | 38 ms / 2,000 ms |
| + 347µs | |
| コード長 | 237 bytes |
| 記録 | |
| コンパイル時間 | 93 ms |
| コンパイル使用メモリ | 64,600 KB |
| 実行使用メモリ | 57,980 KB |
| 最終ジャッジ日時 | 2026-10-16 16:36:11 |
| 合計ジャッジ時間 | 2,606 ms |
|
ジャッジサーバーID (参考情報) |
judge2_0 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 21 |
ソースコード
n, p = map(int, input().split())
k = 0
pp = p
while pp <= n:
k += n // pp
pp *= p
mod = 1_000_000_007
x = 1
y = 1
for i in range(1, n + 1):
x *= i
x %= mod
y *= i
y %= mod - 1
print(k * pow(x, y, mod) % mod)