結果

問題 No.2326 Factorial to the Power of Factorial to the...
ユーザー とりゐとりゐ
提出日時 2023-05-28 13:56:21
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 81 ms / 2,000 ms
コード長 206 bytes
コンパイル時間 256 ms
コンパイル使用メモリ 87,108 KB
実行使用メモリ 76,244 KB
最終ジャッジ日時 2023-08-27 08:41:16
合計ジャッジ時間 2,864 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 74 ms
76,160 KB
testcase_01 AC 81 ms
76,156 KB
testcase_02 AC 73 ms
75,840 KB
testcase_03 AC 75 ms
75,988 KB
testcase_04 AC 78 ms
76,244 KB
testcase_05 AC 75 ms
75,992 KB
testcase_06 AC 73 ms
76,068 KB
testcase_07 AC 76 ms
76,016 KB
testcase_08 AC 77 ms
76,056 KB
testcase_09 AC 76 ms
76,068 KB
testcase_10 AC 74 ms
76,028 KB
testcase_11 AC 76 ms
75,980 KB
testcase_12 AC 76 ms
76,056 KB
testcase_13 AC 77 ms
76,128 KB
testcase_14 AC 74 ms
76,156 KB
testcase_15 AC 76 ms
76,244 KB
testcase_16 AC 73 ms
76,128 KB
testcase_17 AC 76 ms
76,204 KB
testcase_18 AC 74 ms
76,156 KB
testcase_19 AC 74 ms
75,792 KB
testcase_20 AC 70 ms
71,592 KB
testcase_21 AC 70 ms
71,148 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

mod=10**9+7
n,p=map(int,input().split())
cnt=0
for i in range(1,n+1):
  while i%p==0:
    cnt+=1
    i//=p

x=1
y=1
for i in range(1,n+1):
  x*=i
  y*=i
  x%=mod
  y%=mod-1

z=pow(x,y,mod)

print(cnt*z%mod)
0