mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-09-13 11:21:42 +08:00
批量更新数据
This commit is contained in:
@@ -5,32 +5,36 @@
|
||||
<p> </p>
|
||||
|
||||
<p><strong>示例 1:</strong></p>
|
||||
|
||||
<img alt="" src="https://assets.leetcode.com/uploads/2022/03/18/cheapest-flights-within-k-stops-3drawio.png" style="width: 332px; height: 392px;" />
|
||||
<pre>
|
||||
<strong>输入:</strong>
|
||||
n = 3, edges = [[0,1,100],[1,2,100],[0,2,500]]
|
||||
src = 0, dst = 2, k = 1
|
||||
<strong>输出:</strong> 200
|
||||
<strong>解释:</strong>
|
||||
城市航班图如下
|
||||
<img alt="" src="https://s3-lc-upload.s3.amazonaws.com/uploads/2018/02/16/995.png" style="height: 180px; width: 246px;" />
|
||||
|
||||
从城市 0 到城市 2 在 1 站中转以内的最便宜价格是 200,如图中红色所示。</pre>
|
||||
n = 4, flights = [[0,1,100],[1,2,100],[2,0,100],[1,3,600],[2,3,200]], src = 0, dst = 3, k = 1
|
||||
<strong>输出:</strong> 700
|
||||
<strong>解释:</strong> 城市航班图如上
|
||||
从城市 0 到城市 3 经过最多 1 站的最佳路径用红色标记,费用为 100 + 600 = 700。
|
||||
请注意,通过城市 [0, 1, 2, 3] 的路径更便宜,但无效,因为它经过了 2 站。
|
||||
</pre>
|
||||
|
||||
<p><strong>示例 2:</strong></p>
|
||||
|
||||
<img alt="" src="https://assets.leetcode.com/uploads/2022/03/18/cheapest-flights-within-k-stops-1drawio.png" style="width: 332px; height: 242px;" />
|
||||
<pre>
|
||||
<strong>输入:</strong>
|
||||
n = 3, edges = [[0,1,100],[1,2,100],[0,2,500]]
|
||||
src = 0, dst = 2, k = 0
|
||||
<strong>输出:</strong> 500
|
||||
n = 3, edges = [[0,1,100],[1,2,100],[0,2,500]], src = 0, dst = 2, k = 1
|
||||
<strong>输出:</strong> 200
|
||||
<strong>解释:</strong>
|
||||
城市航班图如下
|
||||
<img alt="" src="https://s3-lc-upload.s3.amazonaws.com/uploads/2018/02/16/995.png" style="height: 180px; width: 246px;" />
|
||||
城市航班图如上
|
||||
从城市 0 到城市 2 经过最多 1 站的最佳路径标记为红色,费用为 100 + 100 = 200。
|
||||
</pre>
|
||||
|
||||
从城市 0 到城市 2 在 0 站中转以内的最便宜价格是 500,如图中蓝色所示。</pre>
|
||||
|
||||
<p> </p>
|
||||
<p><strong class="example">示例 3:</strong></p>
|
||||
<img alt="" src="https://assets.leetcode.com/uploads/2022/03/18/cheapest-flights-within-k-stops-2drawio.png" style="width: 332px; height: 242px;" />
|
||||
<pre>
|
||||
<b>输入:</b>n = 3, flights = [[0,1,100],[1,2,100],[0,2,500]], src = 0, dst = 2, k = 0
|
||||
<b>输出:</b>500
|
||||
<strong>解释:</strong>
|
||||
城市航班图如上
|
||||
从城市 0 到城市 2 不经过站点的最佳路径标记为红色,费用为 500。
|
||||
</pre>
|
||||
|
||||
<p><strong>提示:</strong></p>
|
||||
|
||||
|
Reference in New Issue
Block a user