18741 [백준] 스택 수열 / 1874번 / 파이썬 / python 🎫code ) from sys import stdin input = stdin.readline n = int(input()) nums = [int(input()) for _ in range(n)] cnt, s, res = 1, [], [] # res 결과값 리스트 for i in nums: while i >= cnt: s.append(cnt) res.append('+') cnt += 1 if s.pop() != i: print('NO') break else: res.append('-') else: print('\n'.join(res)) 📌 description ) 문제출처 : www.acmicpc.net/problem/1874 1874번: 스택 수열 1부터 n까지에 수에 대해 차례로 [push, push.. 2020. 10. 22. 이전 1 다음