백준 :: 셀프 넘버 <4673번>

혜 콩·2022년 5월 27일
0

알고리즘

목록 보기
19/61

> 문제 <

https://www.acmicpc.net/problem/4673

> 코드 <

# mine

dn = []
selfnum = []

for i in range(1, 10001):
    d = i
    for j in str(i):
        d += int(j)          # d는 생성자가 존재하므로 셀프 넘버 x
    dn.append(d)

    if i not in dn:
        selfnum.append(i)

print(*selfnum, sep='\n')     # list 원소 한줄씩 출력
profile
배우고 싶은게 많은 개발자📚

0개의 댓글