0

So, on this online game, there's this currency system where you want to break down these large coins into smaller denominations because of their desirability, but you can only do so by purchasing these items. You are allowed to combine small coins into larger coins, but they can only be done in exact amounts.

The coin system follows as {1, 2, 5, 10, 20, 50, 100, 200, 500, and 1,000}

The cheapest items that can be purchased to break down the coins are {3, 4, 5, and 6}

The most desirable coin denomination is the Five coin, then the Two coin, and lastly the One coin.


I was thinking if I started with a Ten coin, then I would have 10 - 3 = 7 or (5+2).

EDIT: I got this process wrong, and should have mentioned that the returned change is in the largest denominations, and you cannot ask for certain amounts of a specified coin.

If I expanded that to a One Hundred coin then I would something like 100 - 30 (3 items * 10) = 70 or (10 Five coins and 10 Two Coins).

Combining the 10 Two coins would give me a Twenty coin, so 20 - 6 (3 items * 2) = 14 (Two x2 Five x2) giving me a total of 12 Five Coins and 2 Two coins.

EDIT 2: 100 Coin = {50, 20, 20, 5, 2}

50 = {20, 20, 5, 2} // Total: {20, 20, 20, 20, 5, 5, 2}

20 = {10, 5, 2}

20 = {10, 5, 2}

20 = {10, 5, 2}

20 = {10, 5, 2} // Total: {10, 10, 10, 10, 5 (x6), 2 (x6)}

10 = {5, 2}

10 = {5, 2}

10 = {5, 2}

10 = {5, 2} // Total: {5 (x10), 2 (x10)}

2(x10) = 20

20 = {10, 5, 2} // Total: {5 (x11), 2}

10 = {5, 2} // Total: {5 (x12), 2, 2}

Oh, I ended up getting the same thing...


My questions are:

  • What would be the most efficient process to obtain the maximum of One, Two, and Five coins as possible from the larger coin amounts?

  • Can a formula be derived from this?

Chips
  • 1
  • The rules are not entirely clear. Is it better two have two coins of 2 than one coin of 5? In the example with the 100 coin, why don't you buy something that costs 3 and demand nineteen coins of 5 and one coin of 2 in change? – LinAlg Mar 02 '21 at 18:19
  • It's better to have 1 Five coin than to have 2 Two coins. The change system is weird, but I made an error and should've stated that the return for each process would be in the highest denomination, so a One Hundred coin and purchasing a single item that cost 3 coins would give back 97 (Fifty x1, Twenty x2, Five x1, & Two x1). – Chips Mar 02 '21 at 18:23

0 Answers0