1、喝汽水问题。每7个汽水瓶可以换一瓶汽水,输入为n瓶汽水,求得最后能喝到多少瓶汽水
public static int count(int n){ return n+emptyCount(n); } public static int emptyCount(int m) { int empty; int currentStreamWater=m/7; if (m < 7) { return 0; } if (m % 7 == 0) { empty = currentStreamWater; } else { empty = currentStreamWater + m % 7; } return currentStreamWater+emptyCount(empty); }