結果
| 問題 | No.2326 Factorial to the Power of Factorial to the... |
| コンテスト | |
| ユーザー |
rlangevin
|
| 提出日時 | 2023-05-29 23:09:46 |
| 言語 | PyPy3 (8.0.0 + ACL) |
| 結果 |
AC
不安定
|
| 実行時間 | 38 ms / 2,000 ms |
| + 617µs | |
| コード長 | 247 bytes |
| 記録 | |
| コンパイル時間 | 100 ms |
| コンパイル使用メモリ | 64,660 KB |
| 実行使用メモリ | 57,932 KB |
| 最終ジャッジ日時 | 2026-10-16 16:39:25 |
| 合計ジャッジ時間 | 2,552 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 21 |
ソースコード
N, P = map(int, input().split())
cnt = 0
now = P
while N // now:
cnt += N // now
now *= P
a, x = 1, 1
mod = 10**9 + 7
for i in range(1, N + 1):
a *= i
x *= i
a %= mod
x %= mod - 1
print(cnt * pow(a, x, mod) % mod)
rlangevin