题目描述
blablabla
样例
blablabla
算法1
$O(n^2)$
blablabla
时间复杂度分析:blablabla
Python 代码
class Solution(object):
def maxProductAfterCutting(self,length):
"""
:type length: int
:rtype: int
"""
if length <= 3:
return 1 * (length - 1)
res = 1
if length % 3 == 1:
res = 4
length -= 4
if length % 3 == 2:
res = 2
length -= 2
while length:
res *=3
length -= 3
return res