[백준/Python] 2331번 : 분해합
문제
https://www.acmicpc.net/problem/2231
풀이
1부터 N까지의 숫자를 순회하며 해당 값과 각 자리수의 합을 구하고, 이를 N 값과 대조해주면 된다.
N = int(input())
# find constructor
no_result = True
for i in range(1, N):
rst = i
for c in str(i):
rst += int(c)
if rst == N:
...
studio-pendant.hashnode.dev1 min read