原题目:https://leetcode-cn.com/problems/water-bottles/
代码:
class Solution {
public:
int numWaterBottles(int numBottles, int numExchange) {
int n=numBottles;
int temp = numBottles;
while(temp>=numExchange){
int val = temp / numExchange;
n += val;
temp = val + temp%numExchange;
}
return n;
}
};