Algorithm/Python

[백준 2720번 - 세탁소 사장 동혁]

호찌민 2023. 1. 24. 21:03

문제 풀이 (Python3)

coins = [25, 10, 5, 1]
result = [0, 0, 0, 0]
t = int(input())
c = list()
for _ in range(t):
    c.append(int(input()))

for i in c:
    while True:
        for idx, coin in enumerate(coins):
            result[idx] = i // coin
            i = i % coin
        if i == 0:
            print(' '.join(map(str,result)))
            break