2023-11-11
제로
https://www.acmicpc.net/problem/10773
계산 도와주며 0외치면 삭제 스택 합 구하기
import sys input = sys.stdin.readline k = int(input()) stack = [] for _ in range(k): num = int(input()) if num == 0: stack.pop() else: stack.append(num) print(sum(stack))
2023-11-11
https://www.acmicpc.net/problem/10773
계산 도와주며 0외치면 삭제 스택 합 구하기
import sys input = sys.stdin.readline k = int(input()) stack = [] for _ in range(k): num = int(input()) if num == 0: stack.pop() else: stack.append(num) print(sum(stack))
Copyright (c) 2023. jihyeon Choi. | All Right Reserved.