Computer Science/백준 알고리즘
[백준] 10773 제로 (파이썬)
roytravel
2022. 6. 17. 15:42
import sys
from collections import deque
stack = deque()
input = sys.stdin.readline
N = int(input())
for _ in range(N):
N = int(input())
if N != 0:
stack.append(N)
if N == 0:
stack.pop()
print (sum(stack))