처음에는 백트래킹으로 풀 생각을 했다.. import sys sys.setrecursionlimit(10 ** 6) input = sys.stdin.readline N = int(input()) cnt = 0 def backTracking(depth): if depth == N: global cnt cnt += 1 return elif num[-1] == 0: num.append(1) backTracking(depth + 1) num.pop() elif num[-1] == 9: num.append(8) backTracking(depth + 1) num.pop() else: for i in (num[-1] - 1, num[-1] + 1): num.append(i) backTracking(depth + 1)..