From d6e5bd3f155c8c327beed200b7e893330945384b Mon Sep 17 00:00:00 2001 From: lingkerio whiher Date: Wed, 11 Dec 2024 19:50:44 +0800 Subject: [PATCH] fix(shortest-path.md): fix format about whitespace --- docs/graph/shortest-path.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/graph/shortest-path.md b/docs/graph/shortest-path.md index 97aa847368812..92dc469b000ca 100644 --- a/docs/graph/shortest-path.md +++ b/docs/graph/shortest-path.md @@ -63,9 +63,9 @@ author: du33169, lingkerio, Taoran-01 === "Python" ```python for k in range(1, n + 1): - for x in range(1, n + 1):  - for y in range(1, n + 1):    - f[k][x][y] = min(f[k - 1][x][y], f[k - 1][x][k] + f[k - 1][k][y])  + for x in range(1, n + 1): + for y in range(1, n + 1): + f[k][x][y] = min(f[k - 1][x][y], f[k - 1][x][k] + f[k - 1][k][y]) ``` 因为第一维对结果无影响,我们可以发现数组的第一维是可以省略的,于是可以直接改成 `f[x][y] = min(f[x][y], f[x][k]+f[k][y])`。