题解 | #汽水瓶#

汽水瓶

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

while True:
    s=int(input())
    if s==0:
        break
    remnant=s
    bottles=0
    while True:
        if remnant==2:
            bottles+=1
            break
        if remnant==1:
            break
        bottle=remnant//3
        bottles+=bottle
        remnant=remnant%3+bottle
    print(bottles)

全部评论

相关推荐

迷茫的大四🐶:价格这么低都能满了?
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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