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

 

上一篇:SCI-Hub论文下载可用网址链接 -- 最新!


下一篇:网络知识复习