mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-09-07 08:21:41 +08:00
update
This commit is contained in:
@@ -12,7 +12,7 @@
|
||||
"translatedContent": "<p>给你两个正整数 <code>left</code> 和 <code>right</code> ,满足 <code>left <= right</code> 。请你计算 <strong>闭区间</strong> <code>[left, right]</code> 中所有整数的 <strong>乘积</strong> 。</p>\n\n<p>由于乘积可能非常大,你需要将它按照以下步骤 <strong>缩写</strong> :</p>\n\n<ol>\n\t<li>统计乘积中 <strong>后缀</strong> 0 的数目,并 <strong>移除</strong> 这些 0 ,将这个数目记为 <code>C</code> 。\n\n\t<ul>\n\t\t<li>比方说,<code>1000</code> 中有 <code>3</code> 个后缀 0 ,<code>546</code> 中没有后缀 0 。</li>\n\t</ul>\n\t</li>\n\t<li>将乘积中剩余数字的位数记为 <code>d</code> 。如果 <code>d > 10</code> ,那么将乘积表示为 <code><pre>...<suf></code> 的形式,其中 <code><pre></code> 表示乘积最 <strong>开始</strong> 的 <code>5</code> 个数位,<code><suf></code> 表示删除后缀 0 <strong>之后</strong> 结尾的 <code>5</code> 个数位。如果 <code>d <= 10</code> ,我们不对它做修改。\n\t<ul>\n\t\t<li>比方说,我们将 <code>1234567654321</code> 表示为 <code>12345...54321</code> ,但是 <code>1234567</code> 仍然表示为 <code>1234567</code> 。</li>\n\t</ul>\n\t</li>\n\t<li>最后,将乘积表示为 <strong>字符串</strong> <code>\"<pre>...<suf>eC\"</code> 。\n\t<ul>\n\t\t<li>比方说,<code>12345678987600000</code> 被表示为 <code>\"12345...89876e5\"</code> 。</li>\n\t</ul>\n\t</li>\n</ol>\n\n<p>请你返回一个字符串,表示 <strong>闭区间</strong> <code>[left, right]</code> 中所有整数 <strong>乘积</strong> 的 <strong>缩写</strong> 。</p>\n\n<p> </p>\n\n<p><strong>示例 1:</strong></p>\n\n<pre>\n<b>输入:</b>left = 1, right = 4\n<b>输出:</b>\"24e0\"\n<strong>解释:</strong>\n乘积为 1 × 2 × 3 × 4 = 24 。\n由于没有后缀 0 ,所以 24 保持不变,缩写的结尾为 \"e0\" 。\n因为乘积的结果是 2 位数,小于 10 ,所欲我们不进一步将它缩写。\n所以,最终将乘积表示为 \"24e0\" 。\n</pre>\n\n<p><strong>示例 2:</strong></p>\n\n<pre>\n<strong>输入:</strong>left = 2, right = 11\n<strong>输出:</strong>\"399168e2\"\n<strong>解释:</strong>乘积为 39916800 。\n有 2 个后缀 0 ,删除后得到 399168 。缩写的结尾为 \"e2\" 。 \n删除后缀 0 后是 6 位数,不需要进一步缩写。 \n所以,最终将乘积表示为 \"399168e2\" 。\n</pre>\n\n<p><strong>示例 3:</strong></p>\n\n<pre>\n<strong>输入:</strong>left = 371, right = 375\n<strong>输出:</strong>\"7219856259e3\"\n<strong>解释:</strong>乘积为 7219856259000 。\n</pre>\n\n<p> </p>\n\n<p><strong>提示:</strong></p>\n\n<ul>\n\t<li><code>1 <= left <= right <= 10<sup>4</sup></code></li>\n</ul>\n",
|
||||
"isPaidOnly": false,
|
||||
"difficulty": "Hard",
|
||||
"likes": 4,
|
||||
"likes": 5,
|
||||
"dislikes": 0,
|
||||
"isLiked": null,
|
||||
"similarQuestions": "[]",
|
||||
@@ -137,7 +137,7 @@
|
||||
"__typename": "CodeSnippetNode"
|
||||
}
|
||||
],
|
||||
"stats": "{\"totalAccepted\": \"1.1K\", \"totalSubmission\": \"3.3K\", \"totalAcceptedRaw\": 1121, \"totalSubmissionRaw\": 3288, \"acRate\": \"34.1%\"}",
|
||||
"stats": "{\"totalAccepted\": \"1.2K\", \"totalSubmission\": \"3.5K\", \"totalAcceptedRaw\": 1173, \"totalSubmissionRaw\": 3481, \"acRate\": \"33.7%\"}",
|
||||
"hints": [
|
||||
"Calculating the number of trailing zeros, the last five digits, and the first five digits can all be done separately.",
|
||||
"Use a prime factorization property to find the number of trailing zeros. Use modulo to find the last 5 digits. Use a logarithm property to find the first 5 digits.",
|
||||
|
Reference in New Issue
Block a user