题解 | #汽水瓶#
汽水瓶
https://www.nowcoder.com/practice/fe298c55694f4ed39e256170ff2c205f
# def getChangeColas(n):
# drinks = n // 3
# global count
# count += drinks
# reserve = n % 3
# if drinks + reserve >= 3:
# getChangeColas(drinks + reserve)
# else:
# count += 1
# while 1:
# num = int(input())
# if not num:
# break
# count = 0
# getChangeColas(num)
# print(count)
while 1:
num = int(input())
if not num:
break
print(num // 2)
由递归后引发的思考,有的题就是让你逻辑兜一大圈,实际上tmd。。。每次拿两个空瓶去借一个喝完还回去是刚好不留空瓶的,实际能喝到的数量就是你两个两个空瓶去喝,实际上就是两个空瓶等于一瓶饮料的问题,直接除以2就完了。。。我🤮啦
