This is actually a SPOJ problem: WAYS
Now this is a very easy task what we need to do is to compute the Central binomial coefficients.
However the problem setter includes a very notorious source limit of 120 bytes, so my question is how to get past that source code limit in the languages that are allowed?
Assuming, that
C(2n,n) = (2n)!/(n!)^2 = (2n(2n-1)/n^2) * C(2(n-1),n-1) = ((4n-2)/n)*C(2(n-1),n-1)here is function, which calculates central binomial:Edit: Here is probably shortest code:
It is only 44 characters.