Solve SRM 165, Div 2, Problem BritishCoins

- my score: 247.71 out of 250 points!