MONEYS - Money, Money, Money

Description

Given a whole number of US dollars, what combination of $1, $5, $20, and $100 bills sum to that amount? Choose the combination that minimizes the total number of bills. For example, $10 may be composed of
  • ten $1 bills
  • one $5 and five $1 bills
  • two $5 bills
The fewest bills are the two $5 bills.

Input

An integer number of dollars, from 0 to 1200 inclusive.

Output

The numbers of bills, in the following order: $100, $20, $5, and $1. Separate the numbers by whitespace.
Input Input
10 334
Output Output
0 0 2 0 3 1 2 4

Added by:BYU Admin
Date:2013-10-18
Time limit:1s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All except: ASM64

© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.