原题链接:https://leetcode-cn.com/problems/water-bottles/
代码:
1 class Solution: 2 def numWaterBottles(self, numBottles: int, numExchange: int) -> int: 3 total = numBottles 4 while(numBottles >= numExchange) : 5 numBottles -= numExchange 6 total += 1 7 numBottles += 1 8 return total