@Shishir

cool! this seems to work!!

C[i] = (N-1)/D[i] ; //this is super cool

On Sep 21, 10:29 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
>
>  329.gif
> < 1KViewDownload

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to