| 12
 3
 4
 5
 6
 7
 8
 9
 10
 11
 12
 13
 14
 15
 16
 
 | class Solution {public int cuttingRope(int n) {
 if (n <= 3) {
 return n - 1;
 }
 int x = n / 3;
 int b = n % 3;
 if (b == 0) {
 return (int) Math.pow(3, x);
 } else if (b == 1) {
 return (int) Math.pow(3, x - 1) * 4;
 } else {
 return (int) Math.pow(3, x) * 2;
 }
 }
 }
 
 |