1518. 换酒问题
2020-07-28 本文已影响0人
来到了没有知识的荒原
1518. 换酒问题
class Solution {
public:
int numWaterBottles(int numBottles, int numExchange) {
int res=numBottles;
while(numBottles>=numExchange){
res+=numBottles/numExchange;
numBottles=numBottles/numExchange+numBottles%numExchange;
}
return res;
}
};