알고리즘 문제/알고리즘 문제풀이
백준 1874 스택 수열
태윤2
2020. 10. 25. 19:43
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
n = int(input())
s = []
op = []
count = 1
temp = True
for i in range(n):
num = int(input())
while count <= num:
s.append(count)
op.append('+')
count +=1
if s[-1] == num :
s.pop()
op.append('-')
else :
temp = False
if temp == False:
print('NO')
else:
for i in op:
print(i)
|
cs |