結果

問題 No.2365 Present of good number
ユーザー aaaaaaaaaa2230aaaaaaaaaa2230
提出日時 2023-06-30 23:01:55
言語 PyPy3
(7.3.15)
結果
RE  
実行時間 -
コード長 644 bytes
コンパイル時間 299 ms
コンパイル使用メモリ 87,036 KB
実行使用メモリ 84,824 KB
最終ジャッジ日時 2023-09-21 17:18:37
合計ジャッジ時間 7,361 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 74 ms
71,684 KB
testcase_01 AC 74 ms
71,432 KB
testcase_02 RE -
testcase_03 RE -
testcase_04 AC 75 ms
71,708 KB
testcase_05 RE -
testcase_06 RE -
testcase_07 RE -
testcase_08 RE -
testcase_09 RE -
testcase_10 RE -
testcase_11 RE -
testcase_12 RE -
testcase_13 RE -
testcase_14 RE -
testcase_15 RE -
testcase_16 AC 73 ms
71,648 KB
testcase_17 AC 73 ms
71,688 KB
testcase_18 AC 73 ms
71,824 KB
testcase_19 AC 74 ms
71,860 KB
testcase_20 AC 74 ms
71,840 KB
testcase_21 AC 75 ms
71,868 KB
testcase_22 AC 76 ms
71,984 KB
testcase_23 AC 74 ms
71,764 KB
testcase_24 AC 76 ms
71,708 KB
testcase_25 AC 77 ms
71,812 KB
testcase_26 AC 74 ms
71,832 KB
testcase_27 AC 75 ms
71,544 KB
testcase_28 AC 74 ms
71,560 KB
testcase_29 AC 73 ms
71,644 KB
testcase_30 AC 74 ms
71,704 KB
testcase_31 RE -
testcase_32 RE -
testcase_33 RE -
testcase_34 RE -
testcase_35 RE -
testcase_36 AC 74 ms
71,688 KB
testcase_37 AC 74 ms
71,760 KB
testcase_38 AC 74 ms
71,876 KB
testcase_39 AC 74 ms
71,624 KB
testcase_40 AC 74 ms
71,652 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

def dfs(n,k):

    if k == 0:
        return n

    if n == 1:
        return 1

    if n == 2:
        s = (k+1)//2
        p = pow(2,s,mod-1)
        if k%2:
            return pow(3,p,mod)
        else:
            return pow(2,p,mod)

    
    ans = 1
    now = n
    for i in range(2,int(n**0.5)+1):
        if now%i:
            continue
        num = 0
        while now%i == 0:
            now //= i
            num += 1
        
        ans *= pow(dfs(i+1,k-1),num,mod)
        ans %= mod

    if now != 1:
        ans *= dfs(now+1,k-1)
        ans %= mod

    return ans

print(dfs(n,k))
0