Description
In specified applications very large integers numbers are required. some of these applications are using keys for secure transmission of data, encryption, etc. in this problem you are given a number, you have to determine the number of digits in the factorial of the number.
Input
Input consists of several lines of integer numbers. the first line contains an integer N, which is the number of cases to be tested, followed by n lines, one integer 1 <= m <= 10 ^ 7 on each line.
Output
The output contains the number of digits in the factorial of the integers appearing in the input.
Sample Input
21020
Sample output
719
// The formula must be used for this question. The data size is too large. // Stirling formula: n! = (2 * pI * n) ^ (1/2) * (n/E) ^ N); premise: n> 3 // lg (N!) can be exported !) = (Lg (2 * PI) + lg (N)/2 + N * (lg (N)-lg (e )); # include <iostream> # include <cmath> using namespace STD; int main () {int test, N; long int s; const long double C1 = 0.798179868358; // lg (2 * PI) const long double C2 = 0.434294481903; // lg (e) Long Double C3; CIN> test; while (-- Test + 1) {CIN> N; C3 = log10 (double) n); S = 1; if (n> 3) {S = (C3 + C1) /2 + N * (C3-C2) + 1; cout <S <Endl;} elsecout <1 <Endl;} return 0 ;}