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

2025. 10. 10. 17:43카테고리 없음

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

 

 

 

문제 풀이

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;

public class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        StringBuilder sb = new StringBuilder();

        int T = Integer.parseInt(br.readLine());

        for (int i = 0; i < T; i++) {
            int c = Integer.parseInt(br.readLine());

            int q = c / 25; c %= 25;
            int d = c / 10; c %= 10;
            int n = c / 5;  c %= 5;
            int p = c;

            sb.append(q).append(' ')
              .append(d).append(' ')
              .append(n).append(' ')
              .append(p).append('\n');
        }

        System.out.print(sb.toString());
    }
}