@eSKay, @Ankur, et al., Please be aware that there are non-Indians too in the group.
Hi All, Let me try and define the problem precisely (as far as I can). The ATM machines, which we generally see in India have the following behavior when an user tries to withdraw money from their Bank account. They can give away bills (Indians say "currency note" for "bill") with denominations of 100, 500 and 1000 bucks (Read: your own currency in place of bucks). Obviously you can withdraw only multiples of 100 bucks. It always tries to give at least one and at most five 100 bucks bills. This is the simplest problem definition assuming there is sufficient stock of all the three denominations in the ATM machine. E.g.: Amount=3500 Classic Coin Denomination solution would be coins100 = 0 coins500 = 1 coins1000 = 3 And, our ATM machine answer would be coins100 = 5 coins500 = 0 coins1000 = 3 E.g.: Amount=4000 Classic Coin Denomination solution would be coins100 = 0 coins500 = 0 coins1000 = 4 And, our ATM machine answer would be coins100 = 5 coins500 = 1 coins1000 = 3 E.g.: Amount=3600 Classic Coin Denomination solution would be coins100 = 1 coins500 = 1 coins1000 = 3 And, our ATM machine answer would be coins100 = 1 coins500 = 1 coins1000 = 3 You can use a solution of classic coin denomination problem, which can be solved using Greedy method, and append the following logic. If (coins100 == 0){ if(coins500 != 0){ coins500 = coins500 - 1 coins100 = 5 } else { coins1000 = coins1000 - 1 coins500 = 1 coins100 = 5 } } Thanks, Channa On Sun, Sep 20, 2009 at 7:20 PM, Dufus <rahul.dev.si...@gmail.com> wrote: > > @Ankur I cannot agree more with you > Perhaps a more precise question would have been better instead of just > an observation > > _dufus > > > > On Sep 20, 4:39 pm, ankur aggarwal <ankur.mast....@gmail.com> wrote: > > i think there is no use of discussing this ques.. > > > > On Sun, Sep 20, 2009 at 2:25 PM, eSKay <catchyouraak...@gmail.com> > wrote: > > > > > yes it is different. > > > > > Coin Denomination Problem [ > http://haroonsaeed.wordpress.com/2006/06/06/ > > > coin-denomination-problem/< > http://haroonsaeed.wordpress.com/2006/06/06/%0Acoin-denomination-prob...>] > > > [http://www.seeingwithc.org/ > > > topic1html.html <http://www.seeingwithc.org/%0Atopic1html.html>] > > > would give 2000=1000+1000. > > > > > Thats not the case with an ATM machine. > > > > > On Sep 20, 10:21 am, Dufus <rahul.dev.si...@gmail.com> wrote: > > > > Is it different from classic Coin Denomination problem? > > > > > > _dufus > > > > > > On Sep 19, 11:20 pm, eSKay <catchyouraak...@gmail.com> wrote: > > > > > > > for example: if I draw 2000, what I get is > > > > > 1000+500+100+100+100+100+100. > > > > > > > What algorithm can be used to decide how to break up the entered > > > > > amount? > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algogeeks@googlegroups.com To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/algogeeks -~----------~----~----~----~------~----~------~--~---