結果
| 問題 |
No.2326 Factorial to the Power of Factorial to the...
|
| コンテスト | |
| ユーザー |
rlangevin
|
| 提出日時 | 2023-05-29 23:09:46 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 47 ms / 2,000 ms |
| コード長 | 247 bytes |
| コンパイル時間 | 295 ms |
| コンパイル使用メモリ | 81,920 KB |
| 実行使用メモリ | 58,240 KB |
| 最終ジャッジ日時 | 2024-12-28 10:45:09 |
| 合計ジャッジ時間 | 2,336 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 20 |
ソースコード
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