mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-09-05 07:21:40 +08:00
移除零宽空格
This commit is contained in:
@@ -1,9 +1,9 @@
|
||||
<p>You have the task of delivering some boxes from storage to their ports using only one ship. However, this ship has a <strong>limit</strong> on the <strong>number of boxes</strong> and the <strong>total weight</strong> that it can carry.</p>
|
||||
|
||||
<p>You are given an array <code>boxes</code>, where <code>boxes[i] = [ports<sub>i</sub>, weight<sub>i</sub>]</code>, and three integers <code>portsCount</code>, <code>maxBoxes</code>, and <code>maxWeight</code>.</p>
|
||||
<p>You are given an array <code>boxes</code>, where <code>boxes[i] = [ports<sub>i</sub>, weight<sub>i</sub>]</code>, and three integers <code>portsCount</code>, <code>maxBoxes</code>, and <code>maxWeight</code>.</p>
|
||||
|
||||
<ul>
|
||||
<li><code>ports<sub>i</sub></code> is the port where you need to deliver the <code>i<sup>th</sup></code> box and <code>weights<sub>i</sub></code> is the weight of the <code>i<sup>th</sup></code> box.</li>
|
||||
<li><code>ports<sub>i</sub></code> is the port where you need to deliver the <code>i<sup>th</sup></code> box and <code>weights<sub>i</sub></code> is the weight of the <code>i<sup>th</sup></code> box.</li>
|
||||
<li><code>portsCount</code> is the number of ports.</li>
|
||||
<li><code>maxBoxes</code> and <code>maxWeight</code> are the respective box and weight limits of the ship.</li>
|
||||
</ul>
|
||||
@@ -26,7 +26,7 @@
|
||||
<pre>
|
||||
<strong>Input:</strong> boxes = [[1,1],[2,1],[1,1]], portsCount = 2, maxBoxes = 3, maxWeight = 3
|
||||
<strong>Output:</strong> 4
|
||||
<strong>Explanation:</strong> The optimal strategy is as follows:
|
||||
<strong>Explanation:</strong> The optimal strategy is as follows:
|
||||
- The ship takes all the boxes in the queue, goes to port 1, then port 2, then port 1 again, then returns to storage. 4 trips.
|
||||
So the total number of trips is 4.
|
||||
Note that the first and third boxes cannot be delivered together because the boxes need to be delivered in order (i.e. the second box needs to be delivered at port 2 before the third box).
|
||||
@@ -37,7 +37,7 @@ Note that the first and third boxes cannot be delivered together because the box
|
||||
<pre>
|
||||
<strong>Input:</strong> boxes = [[1,2],[3,3],[3,1],[3,1],[2,4]], portsCount = 3, maxBoxes = 3, maxWeight = 6
|
||||
<strong>Output:</strong> 6
|
||||
<strong>Explanation:</strong> The optimal strategy is as follows:
|
||||
<strong>Explanation:</strong> The optimal strategy is as follows:
|
||||
- The ship takes the first box, goes to port 1, then returns to storage. 2 trips.
|
||||
- The ship takes the second, third and fourth boxes, goes to port 3, then returns to storage. 2 trips.
|
||||
- The ship takes the fifth box, goes to port 2, then returns to storage. 2 trips.
|
||||
@@ -62,6 +62,6 @@ So the total number of trips is 2 + 2 + 2 = 6.
|
||||
<ul>
|
||||
<li><code>1 <= boxes.length <= 10<sup>5</sup></code></li>
|
||||
<li><code>1 <= portsCount, maxBoxes, maxWeight <= 10<sup>5</sup></code></li>
|
||||
<li><code>1 <= ports<sub>i</sub> <= portsCount</code></li>
|
||||
<li><code>1 <= ports<sub>i</sub> <= portsCount</code></li>
|
||||
<li><code>1 <= weights<sub>i</sub> <= maxWeight</code></li>
|
||||
</ul>
|
||||
|
Reference in New Issue
Block a user