結果

問題 No.2365 Present of good number
ユーザー flygonflygon
提出日時 2023-06-30 22:37:34
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 103 ms / 2,000 ms
コード長 1,170 bytes
コンパイル時間 340 ms
コンパイル使用メモリ 87,184 KB
実行使用メモリ 72,276 KB
最終ジャッジ日時 2023-09-21 16:47:09
合計ジャッジ時間 5,958 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 96 ms
71,972 KB
testcase_01 AC 96 ms
71,948 KB
testcase_02 AC 101 ms
72,148 KB
testcase_03 AC 96 ms
72,192 KB
testcase_04 AC 99 ms
71,784 KB
testcase_05 AC 96 ms
71,864 KB
testcase_06 AC 97 ms
71,896 KB
testcase_07 AC 98 ms
72,048 KB
testcase_08 AC 97 ms
72,048 KB
testcase_09 AC 98 ms
71,888 KB
testcase_10 AC 97 ms
71,844 KB
testcase_11 AC 96 ms
72,244 KB
testcase_12 AC 97 ms
72,012 KB
testcase_13 AC 97 ms
72,132 KB
testcase_14 AC 100 ms
72,084 KB
testcase_15 AC 97 ms
72,080 KB
testcase_16 AC 103 ms
71,984 KB
testcase_17 AC 99 ms
72,000 KB
testcase_18 AC 97 ms
72,000 KB
testcase_19 AC 96 ms
72,068 KB
testcase_20 AC 97 ms
72,036 KB
testcase_21 AC 96 ms
71,728 KB
testcase_22 AC 95 ms
71,696 KB
testcase_23 AC 96 ms
71,912 KB
testcase_24 AC 96 ms
72,152 KB
testcase_25 AC 97 ms
72,276 KB
testcase_26 AC 97 ms
71,892 KB
testcase_27 AC 96 ms
72,152 KB
testcase_28 AC 98 ms
72,056 KB
testcase_29 AC 97 ms
72,084 KB
testcase_30 AC 96 ms
71,928 KB
testcase_31 AC 95 ms
71,920 KB
testcase_32 AC 96 ms
71,972 KB
testcase_33 AC 98 ms
72,048 KB
testcase_34 AC 98 ms
72,156 KB
testcase_35 AC 99 ms
72,072 KB
testcase_36 AC 100 ms
71,684 KB
testcase_37 AC 99 ms
72,048 KB
testcase_38 AC 98 ms
71,720 KB
testcase_39 AC 100 ms
72,236 KB
testcase_40 AC 99 ms
72,096 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
sys.setrecursionlimit(5*10**5)
input = sys.stdin.readline
from collections import defaultdict, deque, Counter
from heapq import heappop, heappush
from bisect import bisect_left, bisect_right
from math import gcd

mod = 10**9+7

def fact(n):
    l = []
    tmp = n
    for i in range(2,int(pow(n,0.5))+1):
        if tmp % i == 0:
            cnt = 0
            while tmp % i == 0:
                cnt += 1
                tmp //= i
            l.append([i,cnt])
    if tmp != 1:
        l.append([tmp,1])
    return l

def f(p, cnt):
    if cnt == 0:
        return p
    pf = fact(p)
    ans = 1
    for i in pf:
        if i[0] != 2:
            ans *= pow(f(i[0]+1,cnt-1), i[1], mod)
        else:
            if cnt % 2 == 0:
                ans *= pow(pow(2, pow(2,cnt//2, mod-1), mod), i[1], mod)
            else:
                ans *= pow(pow(3, pow(2,cnt//2, mod-1), mod), i[1],mod)
        ans %= mod
    return ans

def gu(p, cnt):
    for i in range(cnt):
        new = 1
        pf = fact(p)
        for i in pf:
            new*= pow(i[0]+1 , i[1])
        p = new
    return p%mod
        

n,k = map(int,input().split())
print(f(n,k)%mod)


0