Well in spoj you have to use a string of characters . Write your own multiplication algorithm and addition for strings.
Well in other cases say for a project you can use Gnu Multiprecision library GMP .
There is a utility called bc (calculator) which simply rocks . Just check giving 2^1000. In a instant you will get the answer . There you can write a function called fact in bc.
like this
define fact(n)
{
if (n==0)
return 1;
return n*fact(n-1);
}
Verify your answers with that of bc once you write the algorithm.