标签:n+1 image col color img sel div ret class
class Solution: def cuttingRope(self, n: int) -> int: dp=[0 for _ in range(n+1)] dp[2]=1 for i in range(3,n+1): for j in range(i): dp[i]=max(dp[i],max(j*(i-j),dp[i-j]*j)) return dp[n]%1000000007
class Solution: def cuttingRope(self, n: int) -> int: dp = [0 for _ in range(n+1)] dp[0] = 1 for i in range(1, n): #注意这里是n 不是n+1 for j in range(i, n+1): dp[j] = max(dp[j], dp[j-i]*i) return dp[n] % 1000000007
标签:n+1 image col color img sel div ret class
原文地址:https://www.cnblogs.com/topass123/p/12637248.html