题解 | #汽水瓶#
汽水瓶
http://www.nowcoder.com/practice/fe298c55694f4ed39e256170ff2c205f
value=[] result=[] drinked=[] n=1 while n!=0: n=int(input()) if n!=0: value.append(n) for i in range(len(value)): num=value[i] drinked=[] while num>=3: kong = num%3 huan = num//3 drinked.append(huan) nextStart=kong+huan num=nextStart if num==2: result.append(sum(drinked)+1) else: result.append(sum(drinked)) for i in range(len(result)): print(result[i])