0

If i have currencies that are in decimals {0.7,0.8,1.4,0.5} and total amount which also has decimals (example: 1279.6) and I tell you that you need to make total within certain number of currency note counts (example: Total has to be 27.6 and available currencies are 0.7,0.8,1.4,0.5 and you have to use 35 counts of total no. of currency notes. what will be the counts of each currency to make up that total?) The answer to that question would be (13 notes of 0.7 currency + 7 notes of 0.8 currency + 6 notes of 1.4 currency + 9 notes of 0.5 currency would total to 27.6 and total currency count is 35 notes (13+7+6+9))? How can I achieve this through mathematical equations?

  • Is it the decimals that make the problem hard for you? If so, you can just multiply everything by 10. – Gerry Myerson Oct 23 '18 at 09:20
  • Hi @Gerry, It's not the decimal. It's not like regular currency like if I have to make up $888 then I will start by using maximum no. of highest value currency like eight $100 bill and then go down in descending order. With denominations like $1, $2, $5, $10, $20, $50, and $100, you can make up any value. but what if you have denominations like $3, $7, $13, $11, $24, $44, and $97 and using this you have to make up $888. Maybe You can do it but not by using usual method of going from higher to lower denomination. You have to iterate to find out. this is where i am stuck – GirKarr Oct 23 '18 at 10:57
  • OK. Well, I don't know what you mean by "How can I achieve this through mathematical equations." Any particular instance of your question is a finite problem, which you can solve just by systematically going through a finite number of possible solutions to see which one(s), if any, works. There might not be a better way. Have a look at https://math.stackexchange.com/questions/12273/minimum-multi-subset-sum-to-a-target and see whether it helps. – Gerry Myerson Oct 23 '18 at 11:06
  • Had a look at that link, Gir? – Gerry Myerson Oct 24 '18 at 12:13
  • Are you still here, Gir? – Gerry Myerson Oct 26 '18 at 03:47

0 Answers0