Woburn Challenge 1995
Problem 5: Factorial Power
The factorial of a whole number N (written "N!") is defined as follows: N! = 1 * 2 * 3 * ... * (N-1) * N
For example, 10! = 1 x 2 x 3 x 4 x 5 x 6 x 7 x 8 x 9 x 10 = 3628800.
The "factorial length" of a number N is defined as the number of digits in N!.
Thus the factorial length of 10 is 7.
Input
On each of five lines is a positive integer N in the range 1..500.Output
For each of the five inputs, output that number's factorial length in the format shown below.Sample Input
1 2 5 10 52
Sample Output
The length of 1! is 1 The length of 2! is 1 The length of 5! is 3 The length of 10! is 7 The length of 52! is 68
All Submissions
Best Solutions
Point Value: 5
Time Limit: 2.00s
Memory Limit: 16M
Added: Sep 29, 2008
Languages Allowed:
C++03, PAS, C, ASM, C#, C++11
Comments (Search)
What am I doing wrong...
Even a "long long int" only holds just over 18 digits. You won't be able to solve this by simply calculating the factorial.
thanks.
PS I tried to look for ir but it didn't help..:(
However, even the biggest type of integer in C++ can only store about 18 digits, while 52! has 68, so you'll need to think of another way.