public class Solution { public int cutRope(int target) { // 乘积最大,则每个数越平均越好,m 值是动态的 int max = 0; for(int m=2; m <= target; m++){ int c = target/m; int y = target % m; double result = 0; if(y == 0){ result = Math.pow(c, m); }else{ result = Math.pow(c + 1, y) * Math.pow(c, m - y); } max = Math.max(max, (int)result); } return max; } }