java.lang.Object
g0701_0800.s0793_preimage_size_of_factorial_zeroes_function.Solution

public class Solution extends Object
793 - Preimage Size of Factorial Zeroes Function.<p>Hard</p> <p>Let <code>f(x)</code> be the number of zeroes at the end of <code>x!</code>. Recall that <code>x! = 1 * 2 * 3 * ... * x</code> and by convention, <code>0! = 1</code>.</p> <ul> <li>For example, <code>f(3) = 0</code> because <code>3! = 6</code> has no zeroes at the end, while <code>f(11) = 2</code> because <code>11! = 39916800</code> has two zeroes at the end.</li> </ul> <p>Given an integer <code>k</code>, return the number of non-negative integers <code>x</code> have the property that <code>f(x) = k</code>.</p> <p><strong>Example 1:</strong></p> <p><strong>Input:</strong> k = 0</p> <p><strong>Output:</strong> 5</p> <p><strong>Explanation:</strong> 0!, 1!, 2!, 3!, and 4! end with k = 0 zeroes.</p> <p><strong>Example 2:</strong></p> <p><strong>Input:</strong> k = 5</p> <p><strong>Output:</strong> 0</p> <p><strong>Explanation:</strong> There is no x such that x! ends in k = 5 zeroes.</p> <p><strong>Example 3:</strong></p> <p><strong>Input:</strong> k = 3</p> <p><strong>Output:</strong> 5</p> <p><strong>Constraints:</strong></p> <ul> <li><code>0 <= k <= 10<sup>9</sup></code></li> </ul>
  • Constructor Details

    • Solution

      public Solution()
  • Method Details

    • preimageSizeFZF

      public int preimageSizeFZF(int k)