SPOJ FCTRL2

From Algorithmist

Jump to: navigation, search

Contents

[edit] 24 - Small Factorials

[edit] Summary

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.

[edit] Explanation

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

[edit] Implementation

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

[edit] Input

4
1
2
5
3

[edit] Output

1
2
120
6
Personal tools