题解 | #汽水瓶#
汽水瓶
http://www.nowcoder.com/practice/fe298c55694f4ed39e256170ff2c205f
#!/usr/sbin/python # -*- coding: utf-8 -*- def c2one(num): if num > 2: return int(num / 3), num % 3 elif num == 2: return 1, 0 else: return 0, 0 while True: try: input_i = int(input()) result_count = input_i result = 0 if input_i == 0: break while result_count > 1: result_i = c2one(result_count) result_count = int(result_i[0]) + int(result_i[1]) result += int(result_i[0]) print(result) except: break