프로그래머스 69

[프로그래머스] LEVEL2 다리를 지나는 트럭,python3, 스택/큐

def solution(bridge_length, weight, truck_weights): answer = 0 ing=[] # 다리를 건너는 트럭 cnt=[] # 트럭당 지난 거리 ed=[] # 다리를 지난 트력 while 1: if (truck_weights == []) and (ing == []): break answer+=1 # count total time for i in range(len(cnt)): # decrease the times of trucks above the bridge cnt[i]-=1 if (cnt!=[])and(cnt[0]==0): ed.append(ing[0]) del cnt[0] del ing[0] if (sum(ing) max_weight: bridge.append(0..

STUDY/Algorithm 2019.10.22