結果

問題 No.2326 Factorial to the Power of Factorial to the...
ユーザー dangodango
提出日時 2023-06-13 21:27:07
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 80 ms / 2,000 ms
コード長 178 bytes
コンパイル時間 1,092 ms
コンパイル使用メモリ 87,168 KB
実行使用メモリ 75,920 KB
最終ジャッジ日時 2023-09-04 08:34:30
合計ジャッジ時間 3,648 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 79 ms
75,708 KB
testcase_01 AC 79 ms
75,624 KB
testcase_02 AC 78 ms
75,720 KB
testcase_03 AC 80 ms
75,684 KB
testcase_04 AC 77 ms
75,784 KB
testcase_05 AC 79 ms
75,588 KB
testcase_06 AC 79 ms
75,732 KB
testcase_07 AC 80 ms
75,648 KB
testcase_08 AC 80 ms
75,584 KB
testcase_09 AC 79 ms
75,836 KB
testcase_10 AC 80 ms
75,588 KB
testcase_11 AC 79 ms
75,736 KB
testcase_12 AC 80 ms
75,916 KB
testcase_13 AC 79 ms
75,904 KB
testcase_14 AC 80 ms
75,692 KB
testcase_15 AC 79 ms
75,700 KB
testcase_16 AC 80 ms
75,756 KB
testcase_17 AC 80 ms
75,708 KB
testcase_18 AC 80 ms
75,804 KB
testcase_19 AC 79 ms
75,920 KB
testcase_20 AC 75 ms
71,276 KB
testcase_21 AC 77 ms
71,052 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

Q = 10 ** 9 + 7
N, P = map(int,input().split())
A = 0
B = C = 1
for i in range(1, N + 1):
	B, C = B * i % Q, C * i % (Q - 1)
while N:
	N //= P
	A += N
print(A * pow(B, C, Q) % Q)
0