백준/기타

2720번: 세탁소 사장 동혁 [C++]

Koalitsiya 2023. 4. 3. 18:31

문제

 

 

풀이

#include <iostream>
#include <string>

using namespace std;

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);

	int t;

	cin >> t;

	for (int i = 0; i < t; i++) {
		int c;
		int quarter = 0, dime = 0, nickel = 0, penny = 0;

		cin >> c;

		quarter = c / 25;
		c %= 25;

		dime = c / 10;
		c %= 10;

		nickel = c / 5;
		c %= 5;

		penny = c / 1;
		c %= 1;

		cout << quarter << ' ' << dime << ' ' << nickel << ' ' << penny << '\n';
	}

	return 0;
}