結果

問題 No.2326 Factorial to the Power of Factorial to the...
ユーザー sepa38sepa38
提出日時 2023-04-27 16:52:52
言語 PyPy3
(7.3.15)
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 293 bytes
コンパイル時間 318 ms
コンパイル使用メモリ 82,176 KB
実行使用メモリ 58,112 KB
最終ジャッジ日時 2024-05-02 14:54:31
合計ジャッジ時間 2,030 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 51 ms
57,984 KB
testcase_01 WA -
testcase_02 AC 48 ms
57,856 KB
testcase_03 AC 51 ms
57,728 KB
testcase_04 WA -
testcase_05 AC 46 ms
57,728 KB
testcase_06 AC 47 ms
57,984 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 47 ms
58,112 KB
testcase_11 AC 46 ms
57,856 KB
testcase_12 AC 47 ms
57,856 KB
testcase_13 WA -
testcase_14 AC 48 ms
57,984 KB
testcase_15 WA -
testcase_16 AC 46 ms
57,728 KB
testcase_17 WA -
testcase_18 WA -
testcase_19 AC 47 ms
57,984 KB
testcase_20 AC 42 ms
51,840 KB
testcase_21 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

# fpfpf

n, p = map(int, input().split())
mod = 998244353
m = 0
for i in range(1, 20):
  if n // pow(p, i) == 0:
    break
  m += n // pow(p, i)
fac0 = 1
fac1 = 1
for i in range(n):
  fac0 *= i + 1
  fac0 %= mod
  fac1 *= i + 1
  fac1 %= mod - 1
ans = m * pow(fac0, fac1, mod) % mod
print(ans)
0