题解 | #汽水瓶#
汽水瓶
http://www.nowcoder.com/practice/fe298c55694f4ed39e256170ff2c205f
def bottle(n,sum_re): if n==3 or n ==2: sum_re +=1 return sum_re else: a = n//3 b = n%3+a sum_re += a return bottle(b, sum_re) list1 = [] while True: try: a = int(input()) list1.append(a) except: break
for i in list1: if i ==0: break else: sum_re = 0
print(bottle(i,sum_re))