문제
https://www.acmicpc.net/problem/2231
걸린 시간
00 : 19 : 05
풀이
Python3
if __name__ == "__main__":
N = input()
result = []
for i in range(0, int(N)):
total = 0
for j in str(i):
total += int(j)
if i+total == int(N):
result.append(i)
if len(result) == 0:
print('0')
else:
print(min(result))
브루트 포스 문제로 생성자의 조건에 맞는지 0부터 주어진 수 까지 하나씩 증가시켜가며 모두 확인한다.
'Baekjoon' 카테고리의 다른 글
| Baekjoon 2775번 부녀회장이 될테야 (0) | 2020.07.26 |
|---|---|
| Baekjoon 2292번 벌집 (0) | 2020.07.26 |
| Baekjoon 10989번 수 정렬하기 3 (0) | 2020.07.26 |
| Baekjoon 10866번 덱 (0) | 2020.07.26 |
| Baekjoon 2798번 블랙잭 (0) | 2020.07.26 |
댓글