题解 | #汽水瓶#
汽水瓶
https://www.nowcoder.com/practice/fe298c55694f4ed39e256170ff2c205f
while True: try: input_int = int(input()) # 接收空瓶子的数量 if input_int !=0: drink_num =0 bottel_num = input_int left_bottel_num =0 while bottel_num >0: left_bottel = bottel_num % 3 bottel_num = bottel_num // 3 drink_num += bottel_num left_bottel_num += left_bottel # print(left_bottel_num) if left_bottel_num>=3: drink_num+=1 left_bottel_num=left_bottel_num -2 if left_bottel_num==2: drink_num += 1 print(drink_num) except: break
#华为机试#