結果

問題 No.2326 Factorial to the Power of Factorial to the...
ユーザー 遭難者遭難者
提出日時 2023-05-30 00:02:12
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 81 ms / 2,000 ms
コード長 252 bytes
コンパイル時間 327 ms
コンパイル使用メモリ 87,176 KB
実行使用メモリ 76,028 KB
最終ジャッジ日時 2023-08-28 00:14:00
合計ジャッジ時間 3,183 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 75 ms
75,672 KB
testcase_01 AC 79 ms
75,844 KB
testcase_02 AC 76 ms
75,912 KB
testcase_03 AC 81 ms
75,720 KB
testcase_04 AC 78 ms
75,836 KB
testcase_05 AC 76 ms
75,904 KB
testcase_06 AC 76 ms
75,792 KB
testcase_07 AC 78 ms
75,944 KB
testcase_08 AC 79 ms
75,844 KB
testcase_09 AC 80 ms
76,028 KB
testcase_10 AC 76 ms
75,792 KB
testcase_11 AC 77 ms
75,660 KB
testcase_12 AC 76 ms
75,784 KB
testcase_13 AC 79 ms
75,856 KB
testcase_14 AC 76 ms
75,820 KB
testcase_15 AC 78 ms
75,852 KB
testcase_16 AC 75 ms
75,864 KB
testcase_17 AC 78 ms
75,852 KB
testcase_18 AC 78 ms
76,004 KB
testcase_19 AC 77 ms
75,632 KB
testcase_20 AC 72 ms
71,108 KB
testcase_21 AC 72 ms
71,244 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n, p = map(int, input().split())
x1, x2, c = 1, 1, 0
MOD = 10**9 + 7
for i in range(n):
    x1 *= i + 1
    x1 %= MOD
    x2 *= i + 1
    x2 %= MOD - 1
    y = i + 1
    while y % p == 0:
        c += 1
        y //= p
print(c * pow(x1, x2, MOD) % MOD)
0