간단한 문제다 브루트포스 문제가 그냥 생각흐름대로 코딩하기 딱 좋다. n = int(input()) for i in range(n + 1): i_s = str(i) total = i for j in i_s: total += int(j) if total == n: break print(i if i != n else 0)