結果
| 問題 |
No.2326 Factorial to the Power of Factorial to the...
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2023-05-28 14:30:21 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 52 ms / 2,000 ms |
| コード長 | 237 bytes |
| コンパイル時間 | 395 ms |
| コンパイル使用メモリ | 82,432 KB |
| 実行使用メモリ | 57,924 KB |
| 最終ジャッジ日時 | 2024-12-27 01:41:37 |
| 合計ジャッジ時間 | 2,580 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 20 |
ソースコード
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)