15 lines
307 B
Python
15 lines
307 B
Python
def solv(a, b, c) :
|
|
if b == 1 :
|
|
return a%c
|
|
|
|
temp = solv(a,b//2,c)
|
|
|
|
if b%2 == 1 :
|
|
return (temp*temp*a)%c
|
|
else :
|
|
return (temp*temp)%c
|
|
|
|
print(solv(*map(int,input().split())))
|
|
|
|
# 한줄 코드 및 내장함수 사용 코드
|
|
# print(pow(*map(int,input().split()))) |