結果
問題 |
No.2326 Factorial to the Power of Factorial to the...
|
ユーザー |
|
提出日時 | 2023-05-28 14:53:11 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 268 bytes |
コンパイル時間 | 549 ms |
コンパイル使用メモリ | 82,432 KB |
実行使用メモリ | 58,496 KB |
最終ジャッジ日時 | 2024-12-27 03:22:54 |
合計ジャッジ時間 | 2,805 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 11 WA * 9 |
ソースコード
n, p = map(int, input().split()) mod = 10**9+7 fac = [1]*(n+1) for i in range(2, n+1): fac[i] = fac[i-1]*i%mod p2 = p ans = 0 while True: tmp = n // p2 if tmp == 0: break ans += tmp p2 *= p print(pow(fac[n], fac[n], 10**9+7)*ans%(10**9+7))