View Code of Problem 4054

#include<iostream>
#include<string>
#include<algorithm>
#include<stack>
#include<vector>

using namespace std;

int main() {
	int w, n;
	cin >> n;
	while (n--)
	{
		int arr[6] = { 0 };
		int temp;
		cin >> w;
		arr[0] = w / 100;
		temp = w % 100;
		arr[1] = temp / 50;
		temp %= 50;
		arr[2] = temp / 20;
		temp %= 20;
		arr[3] = temp / 10;
		temp %= 10;
		arr[4] = temp / 5;
		temp %= 5;
		arr[5] = temp;
		for (int i = 0; i < 5; i++)
			cout << arr[i] << " ";
		cout << arr[5] << endl;
	}
	return 0;
}

Double click to view unformatted code.


Back to problem 4054