結果

問題 No.2326 Factorial to the Power of Factorial to the...
ユーザー praticapratica
提出日時 2023-05-28 15:53:55
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 385 bytes
コンパイル時間 296 ms
コンパイル使用メモリ 81,920 KB
実行使用メモリ 57,728 KB
最終ジャッジ日時 2024-12-27 09:27:23
合計ジャッジ時間 2,328 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 11 WA * 9
権限があれば一括ダウンロードができます

ソースコード

diff #

mod = 10**9 + 7

def power(a, b, m):
    p = a
    Answer = 1
    for i in range(100):
        if (b>>i)&1:
            Answer = (Answer*p) % m
        p = (p*p) % m
    return Answer

N,P =map(int,input().split())
cnt = 1
for i in range(1,N+1):
    cnt *= i
    cnt %= mod

num = 0
i = P
while i <= N:
    num += N//i
    num %= mod
    i = i**2
    
print(num*power(cnt,cnt,mod)%mod)
0