Problem Description
In many 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 ≤ n ≤ 107 on each line.
Output
The output contains the number of digits in the factorial of the integers appearing in the input.
Sample Input
2
10
20
Sample Output
7
19
定个大数结构体 (int 位数和int 数组[107*3=321~512~1024都行] ,一个数组元素存一个位(十进制原则))
写个函数判断位数(输入大数 输出位数)(判断最高位非零那么该位置index + 1,则为位数)
写个大数乘法(输入两个 大数 输出一个大数)(这个比较考验你算法和进制的熟练程度)
(你可以自己写,也可以百度算法,看你的主动学习能力了)
两层循环(a+b*10+c*100+d*1000......)* (a1+b1*10+c1*100+d1*1000......) 分解开来一位位的算结果考虑进位
写个大数加法(输入两个 大数 输出一个大数)(这个是乘法中需要的) 分解开来一位位的算结果 考虑进位
以上都解决了上面的算法就剩下输入输出,和一个循环了,阶乘就是循环递减的乘法。
可能会有其它效率更好的算法,目前不要过分苛求,因为逻辑可能不大好懂哦