PS
[Programmers] [PCCE 기출문제] 9번 / 지폐 접기
Ry-
2024. 11. 21. 21:22
https://school.programmers.co.kr/learn/courses/30/lessons/340199
프로그래머스
SW개발자를 위한 평가, 교육, 채용까지 Total Solution을 제공하는 개발자 성장을 위한 베이스캠프
programmers.co.kr
def x (a):
a = a//2
return a
def rotation(a,b, wallet):
if wallet[0] >= a and wallet[1] >= b:
return True
else:
if wallet[1] >= a and wallet[0] >= b:
return True
else:
return False
def solution(wallet, bill):
answer = 0
width = bill[0]
legth = bill[1]
while True:
if rotation(width,legth,wallet):
break
else:
if width >= legth:
width = x(width)
answer +=1
flag = rotation(width,legth,wallet)
if flag:
break
else:
legth = x(legth)
answer +=1
flag = rotation(width,legth,wallet)
if flag:
break
return answer