top of page

소스 코드 제출

공개·회원 71명

20250729


# top=-1
# a=[]
# # a.append(data)  # push
# # a.pop()         # pop
#
# # a리스트의 맨 마지막 원소 a[-1]
#
# c=0
# n=int(input())
# for i in range(n) :
#     h=int(input())
#     while len(a)!=0 and h>=a[-1] :       #
#         a.pop()
#     c+=len(a)
#     a.append(h)
# print(c)

a=[]
b=[]
n=int(input())
a = list(map(int, list(input())))
for i in range(n) :
    while len(a)!=0 and a[i]>=a[-1] :
        a.pop()
        b.append([i,a])
    a.append(a)
for i in range(n) :
    print(b.pop(), end=' ')


5회 조회
주소 : 경기도 용인시 광교중앙로 302 블루 스퀘어 602호
연락처 : 031) 216 - 1546 ,     031) 215 - 1546
사업자등록번호 : 465-92-00916
​학원 등록 제 4603호
bottom of page