Problem: print the factorial of a given number N, which is less than 1000.
Size: 1000! has no more than 3000 digits.
Solution: write a big integer with multiplication operation.
Note: computing and storing all 1000 factorials is efficient for multiple query. In practice, 2700 digits are sufficient for 1000!.
No comments:
Post a Comment