백준 #10773 - 제로 python K = int(input()) stack = [] for k in range(K): num = int(input()) if num == 0: del stack[-1] else: stack.append(num) print(sum(stack)) Programming/Algorithm 2019.10.19