其他分享
首页 > 其他分享> > LeetCode1518-换酒问题

LeetCode1518-换酒问题

作者:互联网

原题链接: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

 

标签:问题,cn,原题,int,LeetCode1518,numExchange,换酒,numBottles,total
来源: https://www.cnblogs.com/BigPeng965/p/15799811.html