본문 바로가기
python-algorithm

codeforces 1714C - Minimum Varied Number

by 무적김두칠 2022. 8. 18.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
pythondef sol(n):
    start = 9
    answer = ''
    while n > 0:
        if n >= start:
            n -= start
            answer += str(start)
        else:
            pass
        start -= 1
    return(answer[::-1])
 
for i in range(int(input())):
    n = int(input())
    print(sol(n))
cs
반응형

'python-algorithm' 카테고리의 다른 글

codeforces 1722B - Colourblindness  (0) 2022.09.06
백준 25494 단순한 문제 (Small)  (0) 2022.08.30
백준 4589 Gnome Sequencing  (0) 2022.08.02
백준 4696 St. Ives  (0) 2022.08.02
codeforces 200B - Drinks  (0) 2022.07.20

댓글