문제

 

 

풀이

#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;
}

'백준 > 기타' 카테고리의 다른 글

2609번: 최대공약수와 최소공배수 [C++]  (0) 2023.04.06
1259번: 팰린드롬수 [C++]  (0) 2023.04.06
15829번: Hashing [C++]  (0) 2023.04.06
4153번: 직각삼각형 [C++]  (0) 2023.04.06
2903번: 중앙 이동 알고리즘 [C++]  (0) 2023.04.03

+ Recent posts