题解 | #汽水瓶#
汽水瓶
http://www.nowcoder.com/practice/fe298c55694f4ed39e256170ff2c205f
def myfun(s):
count = s // 3
if s//3+s%3 ==2: # 递归结束条件
count += 1
elif s//3+s%3 == 1: # 递归结束条件
count += 0
else:
count += myfun(s//3+s%3) # 递归
return count
while True:
s = eval(input())
if s == 0:
break
else:
count = myfun(s)
print(count)