| ps | |
|---|---|
| 링크 | acmicpc.net/… |
| 출처 | BOJ |
| 문제 번호 | 4673 |
| 문제명 | 셀프 넘버 |
| 레벨 | 실버 5 |
| 분류 |
기초 |
| 시간복잡도 | O(n) |
| 인풋사이즈 | n=10000 |
| 사용한 언어 | Python |
| 제출기록 | 29968KB / 72ms |
| 최고기록 | 52ms |
| 해결날짜 | 2021/11/12 |
| 태그 | |
"""Solution code for "BOJ 4673. 셀프 넘버".
- Problem link: https://www.acmicpc.net/problem/4673
- Solution link: http://www.teferi.net/ps/problems/boj/4673
"""
def d(n):
ret = n
while n:
n, r = divmod(n, 10)
ret += r
return ret
def main():
non_self_numbers = {d(x) for x in range(1, 10000)}
print(*(x for x in range(1, 10000) if x not in non_self_numbers), sep='\n')
if __name__ == '__main__':
main()