지나가던 개발자

[Python] 백준 10773번(제로) 문제 풀이 본문

PS/Python

[Python] 백준 10773번(제로) 문제 풀이

KwonYongHyeon 2022. 12. 10. 22:23

 

stack = []
for i in range(int(input())):
    n = int(input())
    if n == 0:
        stack.pop()
        continue
    stack.append(n)
print(sum(stack))
Comments