top of page

소스 코드 제출

공개·회원 52명

20250710

# import heapq as hq

# n=int(input())

# a=[]

# q=[]

# for i in range(n):

# x,y=map(int,input().split())

# a.append((x,y))

# a.sort()

# s=0

# for i in range(n):

# if q and q[0]<=a[i][0]:

# hq.heappop(q)

# hq.heappush(q,a[i][1])

# s=max(s,len(q))

# print(s)

import math

n=int(input())

a=list(map(int,input().split()))

if sum(a)==0:

print('0')

exit()

for i in range(n):

for j in range(n-1):

if a[j+1]==0:

if a[j]*10**(10-len(str(a[j])))<a[j+1]*10**(10-len(str(a[j+1]))):

a[j],a[j+1]=a[j+1],a[j]

elif a[j]*10**(10-len(str(a[j])))==a[j+1]*10**(10-len(str(a[j+1]))):

x=a[j]*(10*math.trunc(math.log10(a[j+1])))+a[j+1]

y=a[j+1]*(10*math.trunc(math.log10(a[j])))+a[j]

if x<y:

a[j], a[j + 1] = a[j + 1], a[j]

for x in a:

print(x,end='')

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