题解 | #剪绳子#
剪绳子
http://www.nowcoder.com/practice/57d85990ba5b440ab888fc72b0751bf8
public int cutRope(int target) {
if(target <= 3){
return target - 1;
}
int res = 1;
while(target > 4){
target = target - 3;
res = res * 3;
}
return target * res;
}
}