본문 바로가기

코딩

[Python] 백준 #2720. 세탁소 사장 동혁

https://www.acmicpc.net/problem/2720

 

2720번: 세탁소 사장 동혁

각 테스트케이스에 대해 필요한 쿼터의 개수, 다임의 개수, 니켈의 개수, 페니의 개수를 공백으로 구분하여 출력한다.

www.acmicpc.net

 

# 2720 - Python 3

import sys

input = sys.stdin.readline

t = int(input())

for _ in range(t):
    x = int(input())

    arr = [0 for i in range(4)]

    while True:
        if x - 25 >= 0:
            x -= 25
            arr[0] += 1
        else:
            break

    while True:
        if x - 10 >= 0:
            x -= 10
            arr[1] += 1
        else:
            break
    
    while True:
        if x - 5 >= 0:
            x -= 5
            arr[2] += 1
        else:
            break
    
    arr[3] = x

    print(*arr)

'코딩' 카테고리의 다른 글

[Python] 백준 #1010. 다리 놓기  (0) 2023.03.30
[Python] 백준 #2903. 중앙 이동 알고리즘  (0) 2023.03.29
[Python] 백준 #1966. 프린터 큐  (0) 2023.03.29
[Python] 백준 #10773. 제로  (0) 2023.03.29
[Python] 백준 #10828. 스택  (0) 2023.03.29