1
0
mirror of https://gitee.com/coder-xiaomo/leetcode-problemset synced 2025-09-08 08:51:42 +08:00
Code Issues Projects Releases Wiki Activity GitHub Gitee
This commit is contained in:
2022-05-02 23:44:12 +08:00
parent 7ea03594b3
commit 2a71c78585
4790 changed files with 11696 additions and 10944 deletions

View File

@@ -12,7 +12,7 @@
"translatedContent": "<p>厨房里总共有 <code>n</code>&nbsp;个橘子,你决定每一天选择如下方式之一吃这些橘子:</p>\n\n<ul>\n\t<li>吃掉一个橘子。</li>\n\t<li>如果剩余橘子数 <code>n</code>&nbsp;能被 2 整除,那么你可以吃掉 <code>n/2</code> 个橘子。</li>\n\t<li>如果剩余橘子数&nbsp;<code>n</code>&nbsp;能被 3 整除,那么你可以吃掉 <code>2*(n/3)</code> 个橘子。</li>\n</ul>\n\n<p>每天你只能从以上 3 种方案中选择一种方案。</p>\n\n<p>请你返回吃掉所有 <code>n</code>&nbsp;个橘子的最少天数。</p>\n\n<p>&nbsp;</p>\n\n<p><strong>示例 1</strong></p>\n\n<pre><strong>输入:</strong>n = 10\n<strong>输出:</strong>4\n<strong>解释:</strong>你总共有 10 个橘子。\n第 1 天:吃 1 个橘子,剩余橘子数 10 - 1 = 9。\n第 2 天:吃 6 个橘子,剩余橘子数 9 - 2*(9/3) = 9 - 6 = 3。9 可以被 3 整除)\n第 3 天:吃 2 个橘子,剩余橘子数 3 - 2*(3/3) = 3 - 2 = 1。\n第 4 天:吃掉最后 1 个橘子,剩余橘子数 1 - 1 = 0。\n你需要至少 4 天吃掉 10 个橘子。\n</pre>\n\n<p><strong>示例 2</strong></p>\n\n<pre><strong>输入:</strong>n = 6\n<strong>输出:</strong>3\n<strong>解释:</strong>你总共有 6 个橘子。\n第 1 天:吃 3 个橘子,剩余橘子数 6 - 6/2 = 6 - 3 = 3。6 可以被 2 整除)\n第 2 天:吃 2 个橘子,剩余橘子数 3 - 2*(3/3) = 3 - 2 = 1。3 可以被 3 整除)\n第 3 天:吃掉剩余 1 个橘子,剩余橘子数 1 - 1 = 0。\n你至少需要 3 天吃掉 6 个橘子。\n</pre>\n\n<p><strong>示例 3</strong></p>\n\n<pre><strong>输入:</strong>n = 1\n<strong>输出:</strong>1\n</pre>\n\n<p><strong>示例 4</strong></p>\n\n<pre><strong>输入:</strong>n = 56\n<strong>输出:</strong>6\n</pre>\n\n<p>&nbsp;</p>\n\n<p><strong>提示:</strong></p>\n\n<ul>\n\t<li><code>1 &lt;= n &lt;= 2*10^9</code></li>\n</ul>\n",
"isPaidOnly": false,
"difficulty": "Hard",
"likes": 109,
"likes": 110,
"dislikes": 0,
"isLiked": null,
"similarQuestions": "[]",
@@ -143,7 +143,7 @@
"__typename": "CodeSnippetNode"
}
],
"stats": "{\"totalAccepted\": \"8.6K\", \"totalSubmission\": \"28.2K\", \"totalAcceptedRaw\": 8573, \"totalSubmissionRaw\": 28176, \"acRate\": \"30.4%\"}",
"stats": "{\"totalAccepted\": \"8.8K\", \"totalSubmission\": \"28.6K\", \"totalAcceptedRaw\": 8775, \"totalSubmissionRaw\": 28585, \"acRate\": \"30.7%\"}",
"hints": [
"In each step, choose between 2 options:\r\nminOranges = 1 + min( (n%2) + f(n/2), (n%3) + f(n/3) )\r\nwhere f(n) is the minimum number of days to eat n oranges."
],