結果

問題 No.2326 Factorial to the Power of Factorial to the...
ユーザー aaaaaaaaaa2230aaaaaaaaaa2230
提出日時 2023-05-28 15:40:07
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 83 ms / 2,000 ms
コード長 294 bytes
コンパイル時間 862 ms
コンパイル使用メモリ 86,920 KB
実行使用メモリ 76,024 KB
最終ジャッジ日時 2023-08-27 12:40:18
合計ジャッジ時間 2,996 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 77 ms
75,768 KB
testcase_01 AC 80 ms
75,948 KB
testcase_02 AC 78 ms
75,860 KB
testcase_03 AC 80 ms
75,936 KB
testcase_04 AC 83 ms
76,024 KB
testcase_05 AC 75 ms
75,728 KB
testcase_06 AC 75 ms
75,624 KB
testcase_07 AC 78 ms
75,796 KB
testcase_08 AC 80 ms
75,812 KB
testcase_09 AC 80 ms
75,944 KB
testcase_10 AC 76 ms
75,916 KB
testcase_11 AC 76 ms
75,720 KB
testcase_12 AC 76 ms
75,916 KB
testcase_13 AC 81 ms
75,796 KB
testcase_14 AC 78 ms
75,920 KB
testcase_15 AC 80 ms
75,904 KB
testcase_16 AC 77 ms
75,916 KB
testcase_17 AC 78 ms
75,864 KB
testcase_18 AC 79 ms
75,852 KB
testcase_19 AC 79 ms
75,616 KB
testcase_20 AC 74 ms
71,288 KB
testcase_21 AC 76 ms
71,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n,p = map(int,input().split())
mod = 10**9+7

num = 0
facts = 1
fact2 = 1
for i in range(1,n+1):
    now = i
    while now%p == 0:
        now //= p
        num += 1
    
    facts *= i
    facts %= mod
    fact2 *= i
    fact2 %= mod-1
po = pow(facts,fact2,mod)
ans = num * po % mod
print(ans)
0