TopCoder problem "BritishCoins" used in SRM 165 (Division II Level One)



Problem Statement

    

Prior to 1971, Britain used a system of coins that can be traced back to the time of Charlemagne. The three main units of coinage were the penny, the shilling, and the pound. There were 12 pennies in a shilling and 20 shillings in a pound. Given a number pence of pennies, convert this amount into pounds, shillings, and pennies by first converting as many pennies as possible into pounds, and then converting as many of the remaining pennies as possible into shillings. Return a int[] of size three containing the number of pounds, the number of shillings, and the number of pennies, in that order.

 

Definition

    
Class:BritishCoins
Method:coins
Parameters:int
Returns:int[]
Method signature:int[] coins(int pence)
(be sure your method is public)
    
 

Constraints

-pence is between 0 and 10000, inclusive.
 

Examples

0)
    
533
Returns: { 2,  4,  5 }
First, we make 2 pounds, leaving 53 pence. Then, we make 4 shillings, leaving 5 pence.
1)
    
0
Returns: { 0,  0,  0 }
2)
    
6
Returns: { 0,  0,  6 }
3)
    
4091
Returns: { 17,  0,  11 }
4)
    
10000
Returns: { 41,  13,  4 }

Problem url:

http://www.topcoder.com/stat?c=problem_statement&pm=1862

Problem stats url:

http://www.topcoder.com/tc?module=ProblemDetail&rd=4630&pm=1862

Writer:

Unknown

Testers:

lbackstrom , brett1479

Problem categories:

Simple Math