1
0
mirror of https://gitee.com/coder-xiaomo/leetcode-problemset synced 2025-01-11 19:18:14 +08:00
Code Issues Projects Releases Wiki Activity GitHub Gitee
leetcode-problemset/leetcode-cn/problem (Chinese)/阶乘函数后 K 个零 [preimage-size-of-factorial-zeroes-function].html

40 lines
1.1 KiB
HTML
Raw Normal View History

2022-03-27 20:46:41 +08:00
<p>&nbsp;<code>f(x)</code>&nbsp;&nbsp;<code>x!</code>&nbsp;末尾是 0 的数量。回想一下&nbsp;<code>x! = 1 * 2 * 3 * ... * x</code>,且 <code>0! = 1</code>&nbsp;</p>
<ul>
<li>例如,&nbsp;<code>f(3) = 0</code>&nbsp;,因为 <code>3! = 6</code> 的末尾没有 0 ;而 <code>f(11) = 2</code>&nbsp;,因为 <code>11!= 39916800</code> 末端有 2 个 0 。</li>
</ul>
<p>给定&nbsp;<code>k</code>,找出返回能满足 <code>f(x) = k</code>&nbsp;的非负整数 <code>x</code>&nbsp;的数量。</p>
<p>&nbsp;</p>
<p><strong>示例 1</strong><strong> </strong></p>
<pre>
<strong>输入:</strong>k = 0<strong>
输出:</strong>5<strong>
解释:</strong>0!, 1!, 2!, 3!, 和 4!&nbsp;均符合 k = 0 的条件。
</pre>
<p><strong>示例 2</strong></p>
<pre>
<strong>输入:</strong>k = 5
<strong>输出:</strong>0
<strong>解释:</strong>没有匹配到这样的 x!,符合 k = 5 的条件。</pre>
<p><strong>示例 3:</strong></p>
<pre>
<strong>输入:</strong> k = 3
<strong>输出:</strong> 5
</pre>
<p>&nbsp;</p>
<p><strong>提示:</strong></p>
<ul>
<li><code>0 &lt;= k &lt;= 10<sup>9</sup></code></li>
</ul>