문제풀이/백준(Boj) 문제풀이

[백준][수학/문자열/정렬] 1755. 숫자놀이 (파이썬/Python)

얄루몬 2021. 9. 30. 13:50

 

import sys
input = sys.stdin.readline


o = {'8':'0', '5':'1', '4':'2', '9':'3', '1':'4', '7':'5', '6':'6', '3':'7', '2':'8', '0':'9'}
m, n = map(int, input().split())
r = []
for i in range(m, n+1):
    s = [str(i)]
    k = ""
    for j in s[0]:
        k += o[j]
    s.append(k)
    r.append(s)
    r = sorted(r, key=lambda x:x[1])
for i, j in enumerate(r):
    if (i+1)%10 == 0:
        print(j[0])
    else:
        print(j[0], end=" ")