오답
N = int(input())
_sum = 0
_lists = []
for i in range(1, N):
for j in str(i):
_sum += int(j)
if _sum + i == N:
_lists.append(i)
else:
_sum = 0
print (min(_lists))
오답2
N = int(input())
_sum = 0
_lists = []
for i in range(1, N):
b = list(map(int, list(str(i))))
_sum = sum(b)
if _sum + i == N:
_lists.append(i)
else:
_sum = 0
print (min(_lists))
정답
from collections import deque
def fail():
for i in range(N):
if len(queue) > 1:
del queue[0]
temp = queue[0]
del queue[0]
queue.append(temp)
else:
print (queue[0])
def success(queue):
for i in range(len(queue)):
if len(queue) == 1:
print (queue[0])
break
queue.popleft()
queue.append(queue[0])
queue.popleft()
if __name__ == "__main__":
N = int(input())
queue = deque([i for i in range(1, N + 1)])
success(queue)