結果

問題 No.2365 Present of good number
ユーザー flygonflygon
提出日時 2023-06-30 22:18:18
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 990 bytes
コンパイル時間 1,547 ms
コンパイル使用メモリ 86,760 KB
実行使用メモリ 72,136 KB
最終ジャッジ日時 2023-09-21 16:23:36
合計ジャッジ時間 7,023 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 98 ms
71,856 KB
testcase_01 AC 95 ms
71,528 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 AC 98 ms
72,136 KB
testcase_05 AC 97 ms
71,816 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 AC 103 ms
71,860 KB
testcase_17 WA -
testcase_18 WA -
testcase_19 AC 97 ms
71,888 KB
testcase_20 AC 97 ms
72,036 KB
testcase_21 WA -
testcase_22 WA -
testcase_23 AC 98 ms
71,852 KB
testcase_24 AC 96 ms
72,132 KB
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 AC 95 ms
71,980 KB
testcase_32 WA -
testcase_33 AC 97 ms
72,028 KB
testcase_34 WA -
testcase_35 WA -
testcase_36 AC 96 ms
71,528 KB
testcase_37 AC 98 ms
71,684 KB
testcase_38 AC 98 ms
71,684 KB
testcase_39 WA -
testcase_40 WA -
権限があれば一括ダウンロードができます

ソースコード

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 gu(p, cnt):
    if cnt == 0:
        return p
    pf = fact(p)
    ans = 1
    for i in pf:
        if i[0] != 2:
            ans *= pow(gu(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

n,k = map(int,input().split())
print(gu(n,k))
0