Skip to content

Latest commit

 

History

History
25 lines (20 loc) · 517 Bytes

1629.md

File metadata and controls

25 lines (20 loc) · 517 Bytes

백준 1629번 곱셈

1629


소스코드

  • 메모리 : 30864 KB
  • 시간 : 72 ms
def solution(x,y):
    if y == 1:
        return x % C
    temp = solution(x, y//2)
    if y % 2 == 0:
        return temp**2 % C
    else:
        return temp**2 * x % C
    
A, B, C = map(int, input().split())
print(solution(A,B))