SWEA 1217. 거듭제곱

2024. 3. 7. 21:18코딩 테스트/SWEA

https://swexpertacademy.com/main/code/problem/problemDetail.do?contestProbId=AV14dUIaAAUCFAYD

 

SW Expert Academy

SW 프로그래밍 역량 강화에 도움이 되는 다양한 학습 컨텐츠를 확인하세요!

swexpertacademy.com

 

전체 코드

# Code
def involution(n, m):
    if m < 2:
        return n

    result = n * involution(n, m - 1)
    return result

# ---- submit ----
T = 10
for test_case in range(1, T + 1):
    t_num = int(input())
    n, m = map(int, input().split(' '))

    result = involution(n, m)
    print(f'#{test_case} {result}')