본문 바로가기
Algorithm/Implementaion

[백준] 10773번 제로

by 등촌동 꼬북이 2020. 10. 16.

 

import sys
N = int(sys.stdin.readline())
ans = []
for i in range(N):
    temp = int(sys.stdin.readline())
    if temp == 0:
        ans.pop()
    else:
        ans.append(temp)
print(sum(ans))

'Algorithm > Implementaion' 카테고리의 다른 글

[백준] 2476번 주사위 게임  (0) 2020.10.20
[백준] 4101번 크냐?  (0) 2020.10.20
[백준] 2525번 오븐 시계  (0) 2020.10.20
[백준] 2490번 윷놀이  (0) 2020.10.20
[백준] 1475번 방번호  (0) 2020.10.16

댓글