結果
| 問題 |
No.2326 Factorial to the Power of Factorial to the...
|
| コンテスト | |
| ユーザー |
094
|
| 提出日時 | 2023-05-28 15:14:22 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 474 bytes |
| コンパイル時間 | 323 ms |
| コンパイル使用メモリ | 82,272 KB |
| 実行使用メモリ | 68,780 KB |
| 最終ジャッジ日時 | 2024-12-27 05:25:58 |
| 合計ジャッジ時間 | 2,560 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | RE * 2 |
| other | RE * 20 |
ソースコード
import math
n, p = map(int, input().split())
nfact_cnt = 0
tmp = n
while tmp > 0:
nfact_cnt += tmp // p
tmp = tmp // p
MOD = 10**9 + 7
N = 10**5 + 1010
fact = [1]*(N+1)
r = 1
for i in range(1, N+1):
fact[i] = r = r * i % MOD
nfact = fact[n]
#print(nfact_cnt, pow(nfact, nfact, MOD))
#print(nfact_cnt * pow(nfact, nfact, MOD) % MOD)
#fc = math.factorial(n)
#print("===")
#print(nfact_cnt, pow(nfact, fc, MOD) % MOD)
print(nfact_cnt * pow(nfact, fc, MOD) % MOD)
094