-
1874 스택==> 다시풀기코테 대비 python/백준 2023. 2. 3. 15:02
https://www.acmicpc.net/problem/1874
count = 1 temp = True stack = [] op = [] N = int(input()) for i in range(N): num = int(input()) while count <= num: stack.append(count) op.append('+') count += 1 if stack[-1] == num: stack.pop() op.append('-') else: temp = False break if temp == False: print("NO") else: for i in op: print(i)
'코테 대비 python > 백준' 카테고리의 다른 글
1158 요세푸스 (0) 2023.02.06 2231 분해합 (0) 2023.02.03 2800 스택 ==> 다시풀어보기 (0) 2023.02.02 2346 덱 rotate (0) 2023.02.02 10872 재귀 (0) 2023.02.02