mirror of
https://github.com/halfrost/LeetCode-Go.git
synced 2025-07-07 01:44:56 +08:00
Update 1518 solution
This commit is contained in:
@ -1,4 +1,4 @@
|
||||
# [1518. Water Bottles](https://leetcode-cn.com/problems/water-bottles/)
|
||||
# [1518. Water Bottles](https://leetcode.com/problems/water-bottles/)
|
||||
|
||||
## 题目
|
||||
|
||||
@ -51,8 +51,7 @@ Return the maximum number of water bottles you can drink.
|
||||
|
||||
## 解题思路
|
||||
|
||||
- 模拟
|
||||
首先我们一定可以喝到 numBottles 瓶酒,剩下 numBottles 个空瓶。接下来我们可以拿空瓶子换酒,每次拿出 numExchange 个瓶子换一瓶酒,然后再喝完这瓶酒,得到一个空瓶。这样模拟下去,直到所有的空瓶子小于numExchange结束
|
||||
- 模拟。首先我们一定可以喝到 numBottles 瓶酒,剩下 numBottles 个空瓶。接下来我们可以拿空瓶子换酒,每次拿出 numExchange 个瓶子换一瓶酒,然后再喝完这瓶酒,得到一个空瓶。这样模拟下去,直到所有的空瓶子小于numExchange结束。
|
||||
|
||||
## 代码
|
||||
|
||||
|
Reference in New Issue
Block a user