Another Way to find NcR using higher Secondary school formula :P
void pre()
{
for(int i=0;i<=4000;i++)
nCr[i][0] = 1 ;
for(int i=1;i<=4000;i++)
for(int j=1;j<=i;j++)
nCr[i][j] = ( nCr[i-1][j-1] + nCr[i-1][j] ) % MOD ;
}
void pre()
{
for(int i=0;i<=4000;i++)
nCr[i][0] = 1 ;
for(int i=1;i<=4000;i++)
for(int j=1;j<=i;j++)
nCr[i][j] = ( nCr[i-1][j-1] + nCr[i-1][j] ) % MOD ;
}
Comments
Post a Comment