1
0
mirror of https://gitee.com/coder-xiaomo/leetcode-problemset synced 2025-09-05 07:21:40 +08:00
Code Issues Projects Releases Wiki Activity GitHub Gitee
This commit is contained in:
2022-03-29 16:56:27 +08:00
parent e730aa6794
commit ad15da05aa
2517 changed files with 7358 additions and 7332 deletions

View File

@@ -12,7 +12,7 @@
"translatedContent": "<p>传送带上的包裹必须在 <code>days</code> 天内从一个港口运送到另一个港口。</p>\n\n<p>传送带上的第 <code>i</code>&nbsp;个包裹的重量为&nbsp;<code>weights[i]</code>。每一天,我们都会按给出重量(<code>weights</code>)的顺序往传送带上装载包裹。我们装载的重量不会超过船的最大运载重量。</p>\n\n<p>返回能在 <code>days</code> 天内将传送带上的所有包裹送达的船的最低运载能力。</p>\n\n<p>&nbsp;</p>\n\n<p><strong>示例 1</strong></p>\n\n<pre>\n<strong>输入:</strong>weights = [1,2,3,4,5,6,7,8,9,10], days = 5\n<strong>输出:</strong>15\n<strong>解释:</strong>\n船舶最低载重 15 就能够在 5 天内送达所有包裹,如下所示:\n第 1 天1, 2, 3, 4, 5\n第 2 天6, 7\n第 3 天8\n第 4 天9\n第 5 天10\n\n请注意货物必须按照给定的顺序装运因此使用载重能力为 14 的船舶并将包装分成 (2, 3, 4, 5), (1, 6, 7), (8), (9), (10) 是不允许的。 \n</pre>\n\n<p><strong>示例 2</strong></p>\n\n<pre>\n<strong>输入:</strong>weights = [3,2,2,4,1,4], days = 3\n<strong>输出:</strong>6\n<strong>解释:</strong>\n船舶最低载重 6 就能够在 3 天内送达所有包裹,如下所示:\n第 1 天3, 2\n第 2 天2, 4\n第 3 天1, 4\n</pre>\n\n<p><strong>示例 3</strong></p>\n\n<pre>\n<strong>输入:</strong>weights = [1,2,3,1,1], days = 4\n<strong>输出:</strong>3\n<strong>解释:</strong>\n第 1 天1\n第 2 天2\n第 3 天3\n第 4 天1, 1\n</pre>\n\n<p>&nbsp;</p>\n\n<p><strong>提示:</strong></p>\n\n<ul>\n\t<li><code>1 &lt;= days &lt;= weights.length &lt;= 5 * 10<sup>4</sup></code></li>\n\t<li><code>1 &lt;= weights[i] &lt;= 500</code></li>\n</ul>\n",
"isPaidOnly": false,
"difficulty": "Medium",
"likes": 445,
"likes": 446,
"dislikes": 0,
"isLiked": null,
"similarQuestions": "[]",
@@ -149,7 +149,7 @@
"__typename": "CodeSnippetNode"
}
],
"stats": "{\"totalAccepted\": \"71K\", \"totalSubmission\": \"114.3K\", \"totalAcceptedRaw\": 71042, \"totalSubmissionRaw\": 114305, \"acRate\": \"62.2%\"}",
"stats": "{\"totalAccepted\": \"71.2K\", \"totalSubmission\": \"114.6K\", \"totalAcceptedRaw\": 71233, \"totalSubmissionRaw\": 114619, \"acRate\": \"62.1%\"}",
"hints": [
"Binary search on the answer. We need a function possible(capacity) which returns true if and only if we can do the task in D days."
],