레벨2 문제
from collections import deque
def get(n): # 약수 구하는 함수
divisor = []
for i in range(1, n+1):
if (n % i == 0):
divisor.append(i)
return divisor
def solution(brown, yellow):
arr = get(yellow)
arr = deque(arr)
while arr:
# 리스트에 하나 남았을때
if ( len(arr) == 1 ):
one = arr.pop() + 2
answer = [one, one]
break
one = arr.popleft() + 2
two = arr.pop() + 2
border = (one * 2) + (two * 2) - 4
if ( border == brown ):
answer = [two, one]
break
return answer