honey_pot

[python] 백준 9506번 본문

문제 풀이

[python] 백준 9506번

_tera_ 2021. 6. 6. 23:11

while True:
    n = int(input())
    if n == -1:
        break
    else:
        list1 = []
        for i in range(1, n):
            if n % i == 0:
                list1.append(i)

        if sum(list1) == n:
            print(str(n)+' = '+' + '.join(map(str, list1)))
        else:
            print('%d is NOT perfect.' % n)

난... 출력에 약하구나...내일 다시 풀어봐야지

약수 담는 부분 개떡같이 구현하다가 답 안나와서 저 부분 찾아보고 대박사건;;; 완전 천재들이네;;; 하면서 줍줍함

join() 함수도 이렇게 써보는거 처음이다.. 

'문제 풀이' 카테고리의 다른 글

[python] 백준 5717번  (0) 2021.06.08
[python] 백준 9610번  (0) 2021.06.08
[python] 백준 2476번  (0) 2021.06.06
[python] 백준 4101번  (0) 2021.06.06
[python] 백준 2480번  (0) 2021.06.06
Comments