diff --git a/codes/csharp/chapter_dynamic_programming/min_path_sum.cs b/codes/csharp/chapter_dynamic_programming/min_path_sum.cs index bfb75291b..a02f655f4 100644 --- a/codes/csharp/chapter_dynamic_programming/min_path_sum.cs +++ b/codes/csharp/chapter_dynamic_programming/min_path_sum.cs @@ -105,7 +105,7 @@ public class min_path_sum { // 暴力搜索 int res = MinPathSumDFS(grid, n - 1, m - 1); - Console.WriteLine("从左上角到右下角的做小路径和为 " + res); + Console.WriteLine("从左上角到右下角的最小路径和为 " + res); // 记忆化搜索 int[][] mem = new int[n][]; @@ -114,14 +114,14 @@ public class min_path_sum { Array.Fill(mem[i], -1); } res = MinPathSumDFSMem(grid, mem, n - 1, m - 1); - Console.WriteLine("从左上角到右下角的做小路径和为 " + res); + Console.WriteLine("从左上角到右下角的最小路径和为 " + res); // 动态规划 res = MinPathSumDP(grid); - Console.WriteLine("从左上角到右下角的做小路径和为 " + res); + Console.WriteLine("从左上角到右下角的最小路径和为 " + res); // 空间优化后的动态规划 res = MinPathSumDPComp(grid); - Console.WriteLine("从左上角到右下角的做小路径和为 " + res); + Console.WriteLine("从左上角到右下角的最小路径和为 " + res); } } diff --git a/codes/dart/chapter_dynamic_programming/min_path_sum.dart b/codes/dart/chapter_dynamic_programming/min_path_sum.dart index 43c5bdece..5dca91952 100644 --- a/codes/dart/chapter_dynamic_programming/min_path_sum.dart +++ b/codes/dart/chapter_dynamic_programming/min_path_sum.dart @@ -103,18 +103,18 @@ void main() { // 暴力搜索 int res = minPathSumDFS(grid, n - 1, m - 1); - print("从左上角到右下角的做小路径和为 $res"); + print("从左上角到右下角的最小路径和为 $res"); // 记忆化搜索 List> mem = List.generate(n, (i) => List.filled(m, -1)); res = minPathSumDFSMem(grid, mem, n - 1, m - 1); - print("从左上角到右下角的做小路径和为 $res"); + print("从左上角到右下角的最小路径和为 $res"); // 动态规划 res = minPathSumDP(grid); - print("从左上角到右下角的做小路径和为 $res"); + print("从左上角到右下角的最小路径和为 $res"); // 空间优化后的动态规划 res = minPathSumDPComp(grid); - print("从左上角到右下角的做小路径和为 $res"); + print("从左上角到右下角的最小路径和为 $res"); } diff --git a/codes/go/chapter_dynamic_programming/min_path_sum_test.go b/codes/go/chapter_dynamic_programming/min_path_sum_test.go index f40f375db..53ecb1a79 100644 --- a/codes/go/chapter_dynamic_programming/min_path_sum_test.go +++ b/codes/go/chapter_dynamic_programming/min_path_sum_test.go @@ -20,7 +20,7 @@ func TestMinPathSum(t *testing.T) { // 暴力搜索 res := minPathSumDFS(grid, n-1, m-1) - fmt.Printf("从左上角到右下角的做小路径和为 %d\n", res) + fmt.Printf("从左上角到右下角的最小路径和为 %d\n", res) // 记忆化搜索 mem := make([][]int, n) @@ -31,13 +31,13 @@ func TestMinPathSum(t *testing.T) { } } res = minPathSumDFSMem(grid, mem, n-1, m-1) - fmt.Printf("从左上角到右下角的做小路径和为 %d\n", res) + fmt.Printf("从左上角到右下角的最小路径和为 %d\n", res) // 动态规划 res = minPathSumDP(grid) - fmt.Printf("从左上角到右下角的做小路径和为 %d\n", res) + fmt.Printf("从左上角到右下角的最小路径和为 %d\n", res) // 空间优化后的动态规划 res = minPathSumDPComp(grid) - fmt.Printf("从左上角到右下角的做小路径和为 %d\n", res) + fmt.Printf("从左上角到右下角的最小路径和为 %d\n", res) } diff --git a/codes/python/chapter_dynamic_programming/min_path_sum.py b/codes/python/chapter_dynamic_programming/min_path_sum.py index 9cc449216..41d451b26 100644 --- a/codes/python/chapter_dynamic_programming/min_path_sum.py +++ b/codes/python/chapter_dynamic_programming/min_path_sum.py @@ -88,17 +88,17 @@ if __name__ == "__main__": # 暴力搜索 res = min_path_sum_dfs(grid, n - 1, m - 1) - print(f"从左上角到右下角的做小路径和为 {res}") + print(f"从左上角到右下角的最小路径和为 {res}") # 记忆化搜索 mem = [[-1] * m for _ in range(n)] res = min_path_sum_dfs_mem(grid, mem, n - 1, m - 1) - print(f"从左上角到右下角的做小路径和为 {res}") + print(f"从左上角到右下角的最小路径和为 {res}") # 动态规划 res = min_path_sum_dp(grid) - print(f"从左上角到右下角的做小路径和为 {res}") + print(f"从左上角到右下角的最小路径和为 {res}") # 空间优化后的动态规划 res = min_path_sum_dp_comp(grid) - print(f"从左上角到右下角的做小路径和为 {res}") + print(f"从左上角到右下角的最小路径和为 {res}") diff --git a/codes/ruby/chapter_dynamic_programming/min_path_sum.rb b/codes/ruby/chapter_dynamic_programming/min_path_sum.rb index a18fc7b16..b6396dbca 100644 --- a/codes/ruby/chapter_dynamic_programming/min_path_sum.rb +++ b/codes/ruby/chapter_dynamic_programming/min_path_sum.rb @@ -76,18 +76,18 @@ if __FILE__ == $0 # 暴力搜索 res = min_path_sum_dfs(grid, n - 1, m - 1) - puts "从左上角到右下角的做小路径和为 #{res}" + puts "从左上角到右下角的最小路径和为 #{res}" # 记忆化搜索 mem = Array.new(n) { Array.new(m, - 1) } res = min_path_sum_dfs_mem(grid, mem, n - 1, m -1) - puts "从左上角到右下角的做小路径和为 #{res}" + puts "从左上角到右下角的最小路径和为 #{res}" # 动态规划 res = min_path_sum_dp(grid) - puts "从左上角到右下角的做小路径和为 #{res}" + puts "从左上角到右下角的最小路径和为 #{res}" # 空间优化后的动态规划 res = min_path_sum_dp_comp(grid) - puts "从左上角到右下角的做小路径和为 #{res}" + puts "从左上角到右下角的最小路径和为 #{res}" end diff --git a/codes/swift/chapter_dynamic_programming/min_path_sum.swift b/codes/swift/chapter_dynamic_programming/min_path_sum.swift index 640633acf..5c7823d5c 100644 --- a/codes/swift/chapter_dynamic_programming/min_path_sum.swift +++ b/codes/swift/chapter_dynamic_programming/min_path_sum.swift @@ -105,19 +105,19 @@ enum MinPathSum { // 暴力搜索 var res = minPathSumDFS(grid: grid, i: n - 1, j: m - 1) - print("从左上角到右下角的做小路径和为 \(res)") + print("从左上角到右下角的最小路径和为 \(res)") // 记忆化搜索 var mem = Array(repeating: Array(repeating: -1, count: m), count: n) res = minPathSumDFSMem(grid: grid, mem: &mem, i: n - 1, j: m - 1) - print("从左上角到右下角的做小路径和为 \(res)") + print("从左上角到右下角的最小路径和为 \(res)") // 动态规划 res = minPathSumDP(grid: grid) - print("从左上角到右下角的做小路径和为 \(res)") + print("从左上角到右下角的最小路径和为 \(res)") // 空间优化后的动态规划 res = minPathSumDPComp(grid: grid) - print("从左上角到右下角的做小路径和为 \(res)") + print("从左上角到右下角的最小路径和为 \(res)") } }