The
algorithm is to find the combination is:
where, k = (m>(n-m))?m:(n-m)
Another
think have to noted that the result of (k+1)*(k+2)��.n can be as
large as it cross the limit. It is also true for
1*2*3*�*k. So first determine the result (k+1)/1, then multiply
the result of it with (k+2)/2 and so on.
Another think you have to maintain here is that, the problem has
specified the output is integer but nothing mention about the input and
if n=1^100 and m= 1^100 the result is 1 which is an integer.
We know that
+ 1
gives the digit of the number N. Here
+1 gives us the result. We can derive this as
|