题解 | #汽水瓶#

汽水瓶

https://www.nowcoder.com/practice/fe298c55694f4ed39e256170ff2c205f

import sys

input_list = []
while True:
    line = sys.stdin.readline().strip()
    if line == "0":
        break
    input_list.append(line)


def battle(n):
    if n <= 1:
        return 0
    elif n == 2:
        return 1
    else:
        x = n % 3
        y = n // 3
        return y + battle(x + y)


for n in input_list:
    num = battle(int(n))
    print(num)

全部评论

相关推荐

白火同学:能。我当初应届沟通了1200,收简历50,面试10左右吧,加油投吧
点赞 评论 收藏
分享
野猪不是猪🐗:我assume that你must技术aspect是solid的,temperament也挺good的,however面试不太serious,generally会feel style上不够sharp
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务