View Code of Problem 4054

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

using namespace std;

int main() {
	long long w, n;
	cin >> n;
	while (n--)
	{
		long long temp;
		cin >> w;
		cout << w / 100 << " ";
		temp = w % 100;
		if (temp == 0)
		{
			cout << "0 0 0 0 0" << endl;
			continue;
		}
		cout << temp / 50 << " ";
		temp %= 50;
		if (temp == 0)
		{
			cout << "0 0 0 0" << endl;
			continue;
		}
		cout << temp / 20 << " ";
		temp %= 20;
		if (temp == 0)
		{
			cout << "0 0 0" << endl;
			continue;
		}
		cout << temp / 10 << " ";
		temp %= 10;
		if (temp == 0)
		{
			cout << "0 0" << endl;
			continue;
		}
		cout << temp / 5 << " ";
		temp %= 5;
		if (temp == 0)
		{
			cout << "0" << endl;
			continue;
		}
		cout << temp << endl;
	}
	return 0;
}

Double click to view unformatted code.


Back to problem 4054