there was small mistake. correct code is
int count=0;
void fun(int a[],int index,int n,int i)
{
if(index==n)
{
count++;
cout\n;
for(int k=0;kn;k++)
couta[k] ;
return;
}
for(int j=i;j=9;j++)
{
a[index]=j;
fun(a,index+1,n,j+1);
it uses simple backtracking
On Wed, Dec 7, 2011
how to arrive at such a formulation ?
can any one derive this formula ?
On Mon, Sep 26, 2011 at 12:09 AM, asdqwe ayushgoel...@gmail.com wrote:
that would be (n+9)C(n)..
On Sep 25, 10:05 pm, shady sinv...@gmail.com wrote:
@sanjay can you please tell how did you arrive at that solution ?
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;kn;k++)
couta[k] ;
return;
}
for(int j=i;j=9;j++)
{
a[index]=j;
fun(a,index+1,n,j);
}
}
that would be (n+9)C(n)..
On Sep 25, 10:05 pm, shady sinv...@gmail.com wrote:
@sanjay can you please tell how did you arrive at that solution ?
On Sun, Sep 25, 2011 at 12:32 PM, Yogesh Yadav medu...@gmail.com wrote:
+1 Gohana
On Sun, Sep 25, 2011 at 12:28 PM, Sanjay Rajpal
how ?
elaborate on the solution part ? how to arrive at that
formulation ?
On Sep 25, 11:39 pm, asdqwe ayushgoel...@gmail.com wrote:
that would be (n+9)C(n)..
On Sep 25, 10:05 pm, shady sinv...@gmail.com wrote:
@sanjay can you please tell how did you arrive at that solution ?