結果

問題 No.2326 Factorial to the Power of Factorial to the...
ユーザー suisanka12suisanka12
提出日時 2023-05-28 14:53:11
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 268 bytes
コンパイル時間 1,180 ms
コンパイル使用メモリ 87,040 KB
実行使用メモリ 76,852 KB
最終ジャッジ日時 2023-08-27 10:48:38
合計ジャッジ時間 2,902 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 74 ms
75,664 KB
testcase_01 WA -
testcase_02 AC 75 ms
76,124 KB
testcase_03 AC 76 ms
76,336 KB
testcase_04 WA -
testcase_05 AC 74 ms
76,096 KB
testcase_06 AC 76 ms
76,276 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 75 ms
75,824 KB
testcase_11 AC 75 ms
76,092 KB
testcase_12 AC 75 ms
75,932 KB
testcase_13 WA -
testcase_14 AC 75 ms
76,464 KB
testcase_15 WA -
testcase_16 AC 75 ms
76,024 KB
testcase_17 WA -
testcase_18 WA -
testcase_19 AC 75 ms
76,092 KB
testcase_20 AC 71 ms
71,476 KB
testcase_21 AC 72 ms
71,472 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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))
0