본문 바로가기
python-algorithm

백준 13171 A

by 무적김두칠 2021. 12. 30.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
a=int(input())
x=int(input())
ans=1
xtobin=bin(x)[2:][::-1]
tmp=[]
for i in range(65):
    tmp.append(a)
    a=a**2
    a%=1000000007
for i in range(len(xtobin)):
    if int(xtobin[i])==1:
        ans*=tmp[i]
        ans%=1000000007
print(ans)
cs
반응형

댓글