BritishCoins
SRM 165 · 2003-09-23 · by vorthys
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
Constraints
- pence is between 0 and 10000, inclusive.
533
Returns: { 2,
4,
5 }
First, we make 2 pounds, leaving 53 pence. Then, we make 4 shillings, leaving 5 pence.
0
Returns: { 0,
0,
0 }
6
Returns: { 0,
0,
6 }
4091
Returns: { 17,
0,
11 }
10000
Returns: { 41,
13,
4 }
Submissions are judged against all 57 archived test cases, of which 5 are shown here. Case numbers match the judge’s.
Language: C++17 · define a public class BritishCoins with a public method vector<int> coins(int pence) · 57 test cases · 2 s / 256 MB per case