본문 바로가기
알고리즘 문제/알고리즘 문제풀이

백준 10773 제로

by 태윤2 2020. 10. 25.

 

 

1
2
3
4
5
6
7
8
9
10
11
12
13
= int(input())
nums = []
 
for _ in range(n):
  a = int(input())
  if a == 0 and len(nums) != 0:
    nums.pop()
  elif a==0 and len(nums) ==0 :
    continue
  else :
    nums.append(a)
 
print(sum(nums))
cs

 

 

'알고리즘 문제 > 알고리즘 문제풀이' 카테고리의 다른 글

백준 4949 균형잡힌 세상  (0) 2020.10.25
백준 9012 괄호  (0) 2020.10.25
백준 1541 잃어버린 괄호  (0) 2020.10.25
백준 11399 ATM  (0) 2020.10.25
백준 1931 회의실 배정  (0) 2020.10.25