

풀이
import sys
input = sys.stdin.readline
stack = []
op = []
cnt = 1
for i in range(int(input())):
n = int(input())
while cnt < n + 1:
stack.append(cnt)
cnt += 1
op.append("+")
if stack[-1] == n:
stack.pop()
op.append("-")
if len(stack) > 0:
print("NO")
else:
for i in op:
print(i)
| [파이썬/python] 백준 2164번 : 카드2(🥈4) (0) | 2023.05.30 |
|---|---|
| [파이썬/python] 백준 18258번 : 큐 2(🥈4) (0) | 2023.05.30 |
| [파이썬/python] 백준 4949번 : 균형잡힌 세상(🥈3) (0) | 2023.05.26 |
| [파이썬/python] 백준 9012번 : 괄호(🥈4) (0) | 2023.05.26 |
| [파이썬/python] 백준 10828번 : 스택(🥈4) (0) | 2023.05.26 |