题解 | #汽水瓶#
汽水瓶
https://www.nowcoder.com/practice/fe298c55694f4ed39e256170ff2c205f
# 数据读入 arr = [] while True: a = int(input()) if a == 0: break else: arr.append(a) # 递归求能喝多少瓶水 def drink_water(num): m = num // 3 n = num % 3 num = m + n if m == 0 and num == 2: return 1 elif m == 0 and num <= 1: return 0 else: return m + drink_water(num) # 对输入的每一个值进行计算并输出 for i in arr: print(drink_water(i))