详细推导:https://leetcode-cn.com/problems/jian-sheng-zi-lcof/solution/mian-shi-ti-14-i-jian-sheng-zi-tan-xin-si-xiang-by/
class Solution {
public:
int cuttingRope(int n) {
if (n <= 3) return 1 * (n - 1);
int res = 1;
if (n % 3 == 1) res *= 4,n -= 4;
if (n % 3 == 2) res *= 2,n -= 2;
while (n) res *= 3,n -= 3;
return res;
}
};