def solution(n, arr):
    i = 0
    total = 0
    
    while True:
        total += arr[i]
        
        if total >= n:
            return i + 1
        
        i = (i + 1) % len(arr)

n = 20
arr = [3,1,2,4,5]
ret = solution(n, arr)
print("solution 함수의 반환 값은", ret, "입니다.")

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: