사용하는 돈의 액수가 큰 것부터 작은 순서대로 나누었을 때의 나머지가 0보다 크면 빈 리스트에 개수를 추가하여 마지막에 출력한다.
T = int(input())
for tc in range(1, T+1):
N = int(input())
total = []
if N // 50000 > 0:
total.append(N // 50000)
N = N % 50000
if N // 10000 > 0:
total += N // 10000
N = N % 10000
if N // 5000 > 0:
total += N // 5000
N = N % 5000
if N // 1000 > 0:
total += N // 1000
N = N % 1000
if N // 500 > 0:
total += N // 500
N = N % 500
if N // 100 > 0:
total += N // 100
N = N % 100
if N // 50 > 0:
total += N // 50
N = N % 50
if N // 10 > 0:
total += N // 100
N = N % 10
print(total)