Skip to content

Commit d91061d

Browse files
authored
[BOJ] 10773 제로 (S4)
1 parent 24a1af2 commit d91061d

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

김지호/9주차/260224.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# https://www.acmicpc.net/problem/10773
2+
# 제로, 실버4
3+
4+
import sys
5+
sys.stdin = open('../../../input.txt', 'r')
6+
7+
K = int(input().strip())
8+
9+
stack = []
10+
for _ in range(K):
11+
num = int(input().strip())
12+
13+
if num == 0:
14+
stack.pop()
15+
else:
16+
stack.append(num)
17+
18+
print(sum(stack))

0 commit comments

Comments
 (0)