A shopkeeper keeps 25% of the amount given as commission and returns the remaining back, for example if you give him 1$ he will return back 3 quarters. What is the maximum number of quarters you can get back if you have ten dollars.


closed as unclear what you're asking by Peter Taylor, Ben, Deusovi, manshu, dmg Feb 23 '16 at 15:21

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • $\begingroup$ Questions: How does the shopkeeper return change? Does he give "optimal change", or "what we ask for" - meaning if i give him 2 dollars will he give me a 1-dollar bill + 2 quarters back, or will he give me 6 quarters if i ask nicely? :) Also: What does my original money pile look like? is it a 10-dollar bill or ten 1-dollar bills? $\endgroup$ – Piotr Pytlik Feb 23 '16 at 13:20
  • $\begingroup$ Assuming the shopkeeper always returns 'optimal' change using the standard greedy change algorithm then, using the notation (dollars given, dollars and cents returned, quarters received), after the following transactions (10.00,7.50,2)(7.00,5.25,1)(5.00,3.75,3)(3.00,2.25,1)(2.00,1.50,2)(1.00,0.75,3) you end up with 12 quarters. I presume this is what the questioner was asking as the alternative, 30 quarters achieved by asking for your 7.50 change from a single 10.00 dollar transaction to be all in quarters, seems to be too simple. $\endgroup$ – Penguino Feb 23 '16 at 22:04

I must be missing something...

Ask him for 7.50 change in quarters. That is 30 quarters.

  • $\begingroup$ Also, if you have ten 1-dollar bills, you can repeat the example given, giving $1 each time and getting 3 quarters back each time, which will give the 30 quarters you wanted. $\endgroup$ – Piotr Pytlik Feb 23 '16 at 13:11
  • $\begingroup$ I think it's also worth noting in the answer, that 30 quarters is the most you can get (if you have no quarters at the start, and only $1 bills, because you lose exactly 25% and have only quarters left) - as long as these are the restrictions intended... $\endgroup$ – Piotr Pytlik Feb 23 '16 at 13:13
  • $\begingroup$ @PiotrPytlik think the puzzle was meant to be recursive. i.e. now you have \$7.50 so repeat the process. At least, that is the only way I see it getting interesting. $\endgroup$ – Trenin Feb 23 '16 at 13:13
  • $\begingroup$ @Trenin this is problematic, because how do we know how the change is given? Maybe the shopkeep is generous (in a sense) and gives only quarters back in change? Or maybe he always gives the biggest nominal back, so he'd give a 5$, 2$, and 2 quarters? $\endgroup$ – Piotr Pytlik Feb 23 '16 at 13:15
  • 1
    $\begingroup$ @PiotrPytlik that is why I think the puzzle is missing something. As it is stated, this is obviously the right answer. But if you got to sum up all the quarters you ever received, then at least it is not trivial. $\endgroup$ – Trenin Feb 23 '16 at 13:21

Not the answer you're looking for? Browse other questions tagged or ask your own question.