public static int countNum(int num) {
if(num<3) {
return num;
} else {
return (num-num%3)+countNum(num/3+num%3); //num-num%3 能换啤酒的瓶子,num/3+num%3 新的啤酒瓶数
}
}
public static int countNum(int num) {
if(num<3) {
return num;
} else {
return (num-num%3)+countNum(num/3+num%3); //num-num%3 能换啤酒的瓶子,num/3+num%3 新的啤酒瓶数
}
}