this is the solution . it also prints all the possible as well as the total
count
int count=0;
void fun(int a[],int index,int n,int i)
{
if(index==n)
{
count++;
cout<<"\n";
for(int k=0;k<n;k++)
cout<<a[k]<<" ";
return;
}
for(int j=i;j<=9;j++)
{
a[index]=j;
fun(a,index+1,n,j);
}
}
On Mon, Sep 26, 2011 at 12:41 AM, shady <[email protected]> wrote:
> how ?
> elaborate on the solution part.... ? how to arrive at that
> formulation ?
>
> On Sep 25, 11:39 pm, asdqwe <[email protected]> wrote:
> > that would be (n+9)C(n)..
> >
> > On Sep 25, 10:05 pm, shady <[email protected]> wrote:
> >
> >
> >
> >
> >
> >
> >
> > > @sanjay can you please tell how did you arrive at that solution ?
> >
> > > On Sun, Sep 25, 2011 at 12:32 PM, Yogesh Yadav <[email protected]>
> wrote:
> > > > +1 Gohana....
> >
> > > > On Sun, Sep 25, 2011 at 12:28 PM, Sanjay Rajpal <[email protected]>
> wrote:
> >
> > > >> let the number of digits be n
> > > >> then answer would be ((n+9)! ) / (9! * n!)
> >
> > > >> Sanju
> > > >> :)
> >
> > > >> On Sat, Sep 24, 2011 at 11:51 PM, Yogesh Yadav <[email protected]>
> wrote:
> >
> > > >>> mistake in last post...it was not factorial....sum upto n i.e
> =n(n+1)/2
> >
> > > >>> i.e 10! is wrong ...it will be 10(10+1)/2
> >
> > > >>> ....
> > > >>> On Sun, Sep 25, 2011 at 12:14 PM, Yogesh Yadav <
> [email protected]>wrote:
> >
> > > >>>> n=1 n=2 n=3 n=4
> > > >>>> 0 10 10! (10!)!
> > > >>>> 1 9 9! (9!)!
> > > >>>> 2 8 8!
> > > >>>> 3 7 7!
> > > >>>> 4 6 6!
> > > >>>> 5 5 5!
> > > >>>> 6 4 4!
> > > >>>> 7 3 3!
> > > >>>> 8 2 2!
> > > >>>> 9 1 1!
> > > >>>> sum 10 55 220 and so on....
> >
> > > >>>> On Sun, Sep 25, 2011 at 11:46 AM, Sanjay Rajpal <[email protected]
> >wrote:
> >
> > > >>>>> Can you plz tell the answer for
> > > >>>>> for 3 answer=?
> > > >>>>> nd for 4 answer=?
> > > >>>>> Sanju
> > > >>>>> :)
> >
> > > >>>>> On Sat, Sep 24, 2011 at 10:39 PM, Dheeraj Sharma <
> > > >>>>> [email protected]> wrote:
> >
> > > >>>>>> can u plz be more..clear ..with wat the input will consist of..
> > > >>>>>> wat does this mean
> > > >>>>>> "for 2 answer=55"
> > > >>>>>> does that mean..that how many non decreasing digits can be
> formed by 2
> > > >>>>>> digit num
> >
> > > >>>>>> On Sun, Sep 25, 2011 at 1:08 AM, shady <[email protected]>
> wrote:
> >
> > > >>>>>>> A number is said to be made up of non-decreasing digits if all
> the
> > > >>>>>>> digits to the left of any digit is less than or equal to that
> digit. for eg.
> > > >>>>>>> 1122, 234, 2
> >
> > > >>>>>>> 0000, 0011 is a possible 4 digit non decreasing number
> >
> > > >>>>>>> so given a number n, how many n digit numbers exist ?
> >
> > > >>>>>>> for 2 answer = 55
> >
> > > >>>>>>> Can someone post complexity and their approach....
> >
> > > >>>>>>> --
> > > >>>>>>> You received this message because you are subscribed to the
> Google
> > > >>>>>>> Groups "Algorithm Geeks" group.
> > > >>>>>>> To post to this group, send email to
> [email protected].
> > > >>>>>>> To unsubscribe from this group, send email to
> > > >>>>>>> [email protected].
> > > >>>>>>> For more options, visit this group at
> > > >>>>>>>http://groups.google.com/group/algogeeks?hl=en.
> >
> > > >>>>>> --
> > > >>>>>> *Dheeraj Sharma*
> > > >>>>>> Comp Engg.
> > > >>>>>> NIT Kurukshetra
> >
> > > >>>>>> --
> > > >>>>>> You received this message because you are subscribed to the
> Google
> > > >>>>>> Groups "Algorithm Geeks" group.
> > > >>>>>> To post to this group, send email to [email protected]
> .
> > > >>>>>> To unsubscribe from this group, send email to
> > > >>>>>> [email protected].
> > > >>>>>> For more options, visit this group at
> > > >>>>>>http://groups.google.com/group/algogeeks?hl=en.
> >
> > > >>>>> --
> > > >>>>> You received this message because you are subscribed to the
> Google
> > > >>>>> Groups "Algorithm Geeks" group.
> > > >>>>> To post to this group, send email to [email protected].
> > > >>>>> To unsubscribe from this group, send email to
> > > >>>>> [email protected].
> > > >>>>> For more options, visit this group at
> > > >>>>>http://groups.google.com/group/algogeeks?hl=en.
> >
> > > >>> --
> > > >>> You received this message because you are subscribed to the Google
> Groups
> > > >>> "Algorithm Geeks" group.
> > > >>> To post to this group, send email to [email protected].
> > > >>> To unsubscribe from this group, send email to
> > > >>> [email protected].
> > > >>> For more options, visit this group at
> > > >>>http://groups.google.com/group/algogeeks?hl=en.
> >
> > > >> --
> > > >> You received this message because you are subscribed to the Google
> Groups
> > > >> "Algorithm Geeks" group.
> > > >> To post to this group, send email to [email protected].
> > > >> To unsubscribe from this group, send email to
> > > >> [email protected].
> > > >> For more options, visit this group at
> > > >>http://groups.google.com/group/algogeeks?hl=en.
> >
> > > > --
> > > > You received this message because you are subscribed to the Google
> Groups
> > > > "Algorithm Geeks" group.
> > > > To post to this group, send email to [email protected].
> > > > To unsubscribe from this group, send email to
> > > > [email protected].
> > > > For more options, visit this group at
> > > >http://groups.google.com/group/algogeeks?hl=en.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>
>
--
*
Regards*
*"The Coder"*
*"Life is a Game. The more u play, the more u win, the more u win , the
more successfully u play"*
--
You received this message because you are subscribed to the Google Groups
"Algorithm Geeks" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/algogeeks?hl=en.