0.code
class Solution {
public int cuttingRope(int n) {
if(n==2){
return 1;
}
if(n==3){
return 2;
}
int mod = 1000000007;
long res = 1;
while(n>4){
res = res*3;
res = res%mod;
n = n -3;
}
return (int)(res*n%mod);
}
}
网友评论