SPOJ FCTRL2

From Algorithmist
Jump to navigation Jump to search

24 - Small Factorials[edit]

Summary[edit]

The problem asks us to calculate factorials of some small positive integers. This is a standard BigNum problem. Just preprocess the 100 possible answers and print it out when requested.

Explanation[edit]

This is a standard BigNum problem of calculating multiplications. Preprocessing the 100 possible answers will save us time.

Implementation[edit]

Const int MaximumNumberOfDigits = 158; // [log10(100!)]+1 // log(a*b) = log(a)+log(b)

Input[edit]

4
1
2
5
3

Output[edit]

1
2
120
6