idea is to give note of each denomination at least once (if possible). On Mon, Sep 21, 2009 at 10:59 AM, Shishir Mittal <1987.shis...@gmail.com>wrote:
> Let the denominations be D[] = {1000,500,100}, > and amount be N. > Let C[] , denotes the count of each denomination. > for ( i=0 ; i < 2 ; i++) { > C[i] = (N-1)/D[i] ; > N = N - D[i]*C[i] ; > } > C[2] = N/D[2] ; > > For N=4800, C[] = {4, 1, 8} > For N= 2000, C[] = {1, 1, 5}, as required. > > Nice observation :) . > > PS: Its the Newton who appreciated the falling apple. There aren't many who > really appreciate the happenings from our normal life. [?] > On Sat, Sep 19, 2009 at 11:50 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? >> >> >> > > > -- > Shishir Mittal > Ph: +91 9936 180 121 > > > > > --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
<<inline: 329.gif>>