def solution(bridge_length, weight, truck_weights):
answer = 0
count = [] #각각의 트럭이 다리를 건넌 시간
temp = [] #현재 다리 위에 있는 트럭
while True:
print(answer, temp, count, truck_weights)
for i in count:
if i == bridge_length:
temp.pop(0)
count.pop(0)
if truck_weights:
if not temp or (temp and sum(temp)+truck_weights[0] <= weight):
temp.append(truck_weights.pop(0))
count.append(0)
answer += 1
count = [i + 1 for i in count]
if not truck_weights and not temp:
break
return answer