top of page

소스 코드 제출

공개·회원 50명

+ 제목



# 소들의 헤어스타일 1
# import sys
# sys.setrecursionlimit(78956727)
# a = int(input())
# st = []
# count = 0
# def ax (gap):
#     global st,count
#     #print(st,count)
#     if len(st) > 0 and (st[-1] <= gap or (gap == -1 and len(st) > 1 and st[-1] < st[-2])):
#         st.pop()
#         count += len(st)
#         ax(gap)
#     return
# for i in range(a):
#     x = int(input())
#     ax(x)
#     st.append(x)
# ax(-1)
# print(count)
# a = int(input())
# st = []
# count = 0
# for i in range(a):
#     if i<a:
#         x = int(input())
#     # print(st,count)
#     if i > 0 and st[-1] <= x:
#         for j in range(len(st)):
#             if st[-1] <= x:
#                 st.pop()
#             else:
#                 break
#     if len(st) > 0 and st[-1] > x:
#         count += len(st)
#     if i<a:
#         st.append(x)
# print(count)
a = int(input())
st = []
x = list(input().split())
for i in range(1,a+1):
    if i==0:
        st.append(x[a-i])
        print('0',end = '')
        continue
    if x[i] > st[-1]:
        for j in range(len(st)):
            if x[i] > st[-1]:
                st.pop()
            else:
                break
    if x[i] < st[-1]:
        print(' ',len(st),end='')
        st.append(x[i])


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