题目描述: 方法一:动态规划 class Solution: def f(self, n, m): if n < m: n, m = m, n if (n, m) in self.mem: return self.mem[(n, m)] if n == m: ans = else: ans = n*m , n): ans = min(ans, self.f(i, m) + self.f(n-i, m)) , m): ans = min(ans, self.f(n, i) + self.f(n,…