SW Expert Academy

[SWEA] 쉬운 거스름돈 (1970) Python

RiLLa_0511 2023. 5. 24. 01:42
728x90

https://swexpertacademy.com/main/code/problem/problemDetail.do?problemLevel=2&contestProbId=AV5PsIl6AXIDFAUq&categoryId=AV5PsIl6AXIDFAUq&categoryType=CODE&problemTitle=&orderBy=INQUERY_COUNT&selectCodeLang=PYTHON&select-1=2&pageSize=10&pageIndex=2 

 

 

SW Expert Academy

SW 프로그래밍 역량 강화에 도움이 되는 다양한 학습 컨텐츠를 확인하세요!

swexpertacademy.com

 

t = int(input())
money = [50000, 10000, 5000, 1000, 500, 100, 50, 10]
for i in range(1, t+1):
    n = int(input())
    result = [0 for _ in range(8)]
    for j in range(8):
        result[j] = n // money[j]
        n = n % money[j]
    print("#{}".format(i))
    for r in result:
        print(r, end = ' ')
    print()

 

 

 

혼자 공부하며 올리는 블로그입니다. 틀린 내용은 댓글 남겨주시면 감사하겠습니다.