티스토리 뷰
programmers.co.kr/learn/courses/30/lessons/42583
def solution(bridge_length, weight, truck_weights):
answer = 0
bridge = [0] * bridge_length
while(bridge):
answer += 1
bridge.pop(0)
if truck_weights:
if sum(bridge) + truck_weights[0] <= weight:
bridge.append(truck_weights.pop(0))
else:
bridge.append(0)
return answer
'Algorithm > Programmers' 카테고리의 다른 글
[프로그래머스] 튜플 - Python (0) | 2021.03.25 |
---|---|
[프로그래머스] 구명보트 - Python (0) | 2021.03.25 |
[프로그래머스] 주식가격 - Python (0) | 2021.03.25 |
[프로그래머스] 프린터 - Python (0) | 2021.03.25 |
[프로그래머스] 크레인 인형뽑기 게임 - Python (0) | 2021.03.24 |