244일차 - BOJ no.10773

Dzeko·2022년 3월 23일
0

Daily Algorithm

목록 보기
241/396
post-thumbnail

https://www.acmicpc.net/problem/10773

My Solution

import sys

arr = []
K = int(sys.stdin.readline().rstrip())
for _ in range(K):
   n = int(sys.stdin.readline().rstrip())
   if n != 0:
       arr.append(n)
   else:
       arr.pop()

print(sum(arr))

#스택

profile
Hound on the Code

0개의 댓글