https://leetcode.cn/problems/water-bottles-ii/
js
/**
* @param {number} numBottles
* @param {number} numExchange
* @return {number}
*/
var maxBottlesDrunk = function(B, E) {
let R=0
let empty=0
while(true){
[B,empty,R]=[0,empty+B,R+B]
if(B==0&&empty<E){
break
}
[B,empty,E]=[1,empty-E,E+1]
}
return R
};