스택/큐 > 다리를 지나는 트럭
-
스택/큐 > 다리를 지나는 트럭스택(Stack) 2018. 9. 29. 20:52
https://programmers.co.kr/learn/courses/30/lessons/42583 1. 문제 2. 알고리즘키워드 - 스택 3. 코드 12345678910111213141516171819202122232425262728293031323334353637383940414243#include #include #include using namespace std; int solution(int bridge_length, int weight, vector truck_weights) { queue q; int sum, count; sum = count = 0; for(int i=0; i weight) { q.push(0); count++; } else { q.push(d); count++; sum ..