Submit | All submissions | Best solutions | Back to list |
FACTLENG - Factorial length |
Wersja polska | English version |
Given integer n, print length of n! (which is factorial of n).
Input
The first line of the standard input contains one integer t (t<10001) which is the number of test cases.
In each of the next t lines there is number n (0<=n<=5*10^9).
Output
For each test, print the length of n!.
Example
Input: 3
1
10
100
Output: 1
7
158
Added by: | Piotr Kąkol |
Date: | 2009-12-26 |
Time limit: | 4.855s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | All except: NODEJS OBJC SCM qobi VB.NET |
hide comments
|
|||||
2013-08-28 07:56:05 Dominique VAILLANT
@Mitch: And now 52 in awk, absolute record! Rude awakening for me... |
|||||
2013-08-27 13:19:58 Dominique VAILLANT
Wow! 86 in C. Hat's off to Grand Master Mitch! |
|||||
2013-08-18 07:35:50 Raushan Kumar
simple formulae to get number of digits search it up |
|||||
2012-01-28 17:18:12 Piotr KÄ…kol
@saurabh jain - Your PI value is not precise enough. |
|||||
2012-01-24 18:22:50 Saurabh Jain
i dont know why it is showing WA for my code even after my answer matches with the highest value of n!! can u tell me the reason ? |
|||||
2011-05-08 11:26:20 challenger
@HWK - Even if You just reached (not beat) "my" solution I could always disqualify it so that You would be the rightful leader of C in this task. ;-) |
|||||
2011-05-07 20:29:26 HWK
@challenger: It's painful that you've pushed my "nice" C-solution to the second page of best solutions. :-) Edit: Back again! Last edit: 2011-05-08 08:39:09 |
|||||
2010-12-27 23:58:35 Marty OBrien
Thanks Piotr. That solution was OK when perl is built with 64-bit integers, but not with 32-bit. |
|||||
2010-12-23 13:27:45 Piotr KÄ…kol
Yes, for 0! You should print 1. Your mistake is that for bigger numbers You always print -1. Before submitting always check the hardest case. Here for 5*109 You should print 46323377618. |
|||||
2010-12-22 20:10:04 Marty OBrien
Having trouble getting the right answer to this one. The length of 0! is 1, right? |