P21676 [GeeksforGeeks] Count digits in a factorial3957
普及-
题目描述

Given an integer N. You have to find the number of digits that appear in its factorial, where factorial is defined as, factorial(N) = 1234..N and factorial(0) = 1.

Example 1:
Input:
N = 5
Output:
3
Explanation:
5! is 120 so there are 3
digits in 120
Example 2:
Input:
N = 10
Output:
7
Explanation:
10! is 3628800 so there are
7 digits in 3628800
Your Task:
You don't need to read input or print anything. Your task is to complete the function facDigits() which takes an integer N as input parameter and returns the number of digits in factorial of N.

Expected Time Complexity: O(Log(N))
Expected Space Complexity: O(1)

Constraints:
1 ≤ N ≤ 10^{4}

输入格式

见题面

输出格式

见题面

样例输入
N = 5
样例输出
3