Agorithm/백준 알고리즘
백준 알고리즘 1629번 곱셈(python)
kimjinho1
2020. 1. 28. 00:06
728x90
반응형
print(A**B%C)
위와 같이 계산을 하려 하면 시간 초과가 뜬다.
pow를 사용해주자.
EX) pow(2, 4, 3) = 2 ** 4 % 3
A, B, C = map(int, input().split())
print(pow(A, B, C))
728x90
반응형