Math Problem : G.13 Change one yen coins to five and ten coins

There are some one-yen coins.
When I change these into five-yen coins as many as possible, the total number of coins is decreased by 60 pieces.
Furthermore, when I changes those coins into ten-coins as many as possible, the total number of coins becomes ten pieces.
Find the number of one-yen coins first.








Answer
77 pieces

Solution
Whenever changing five pieces of one-yen coins into one piece of five-yen coin, the number of coins decreases by 5 - 1 = four pieces.
Since the total number of coins are decreased by 60 pieces, the number of five-yen coins changed in total is 60 / 4 = 15 pieces.
Two pieces of five-yen coins become one piece of ten-yen coin.
In case 15 pieces of five-yen coins are changed into ten-yen coins, there are seven pieces of ten-yen coins and one piece of five-yen coin based on the calculation that 15 / 2 = 7 remainder 1.
Since total number of coins are ten pieces, it is found that there are 10 - 7 - 1 = 2 pieces of one-yen coins remained.
Therefore the number of one-yen coins is 10 × 7 + 5 × 1 + 2 = 77 pieces.