https://school.programmers.co.kr/learn/courses/30/lessons/42583
def solution(bridge_length, weight, truck_weights):
    answer = 0
    tmp_list = [0]*bridge_length
    idx = 0
    cnt = 1
    tmp_list[0] = truck_weights.pop(0)
    while True:
        if tmp_list.count(0) == len(tmp_list) and len(truck_weights) ==0:
            break
        
        for i in range(len(tmp_list)-1,-1,-1):
            if i == 0:
                tmp_list[i] = 0
            else:
                tmp_list[i] = tmp_list[i-1] 
        if len(truck_weights) !=0:
            if truck_weights[0]+sum(tmp_list) > weight:
                tmp_list[0] = 0
            elif truck_weights[0]+sum(tmp_list) <= weight:
                    tmp_list[0] = truck_weights.pop(0)
        cnt+=1
    return cnt
def solution(bridge_length, weight, truck_weights):
    tmp_list = [0]*bridge_length
    cnt=0
    while True:
        # 탈출 조건
        if len(tmp_list)==0:
            break
        
        if len(truck_weights) !=0:
            tmp_list.pop(0)
            if truck_weights[0] + sum(tmp_list) > weight:
                tmp_list.append(0)
            else:
                tmp_list.append(truck_weights.pop(0))
        else:
            tmp_list.pop(0)
        cnt+=1
    return cnt
def solution(bridge_length, weight, truck_weights):
    tmp_list = [0]*bridge_length
    cnt=0
    bridge_sum = 0
    while True:
        # 탈출 조건
        if len(tmp_list)==0:
            break
        if len(truck_weights) !=0:
        	# 다리 위에 있는 트럭 중 앞에 있는 트럭의 무게 빼기
            bridge_sum -= tmp_list.pop(0) 
            # 다리 위에 새로운 트럭이 올라갔을 때 무게 중량 초과여부 판별
            if truck_weights[0] + bridge_sum > weight: 
                tmp_list.append(0)
            else:
     	        # 다리 위에 새로운 트럭이 올라갔으므로 트럭의 무게 추가
                bridge_sum += truck_weights[0] 
                tmp_list.append(truck_weights.pop(0))
        else:
            tmp_list.pop(0)
        # print (tmp_list)
        cnt+=1
    return cnt
내장함수의 편리함도 물론 중요하지만,
알고리즘 속에서 수식이 계속 반복된다면 단순한 수식을 직접 짜는게 알고리즘의 효율성면에서 더 좋을 수 있다!!!!