class Solution { public: int cutRope(int number) { if (number < 2) return 0; if (number == 2) return 1; if (number == 3) return 2; vector<int> result(number, 0); result[1] = 1; result[2] = 2; result[3] = 3; for (int i = 4; i <= number; ++ i) { for (int j = 1; j <= (i+1)/2; ++ j) { result[i] = max(result[i], result[j]*result[i-j]); } } return result[number]; } };