프로그래머스 Lv.2| Python - 숫자의 표현

pg

풀이

def solution(n):
    count = 0
    
    for i in range(1, n+1):
        sum = 0
        for j in range(i, n+1):
            sum += j
            if sum == n:
                count += 1
                break
            elif sum > n :
                break
    return count

comments powered by Disqus