题目链接:https://leetcode-cn.com/problems/jian-sheng-zi-ii-lcof/
贪心
class Solution {
public:
int cuttingRope(int n) {
if(n <= 3) return 1 *(n - 1);
long long res = 1;
if(n % 3 == 1) res = 4, n -= 4;
else if(n % 3 == 2) res = 2, n -= 2;
while(n) res *= 3, res %= 1000000007, n -= 3;
return res % (1000000007);
}
};