题解 | 汽水瓶

汽水瓶

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

#include <iostream>
using namespace std;

int main() {
    int bot=0,emp_bot;
    while(cin >> emp_bot){
        if(emp_bot == 0) break;
        if(emp_bot == 1) {
            cout<<0<<endl;
            continue;
        }
        while(emp_bot /3 !=0){
            bot += emp_bot/3;
            emp_bot = emp_bot/3+emp_bot%3;
        }
        if(emp_bot == 2) {
            bot+=1; 
        }
        cout << bot <<endl;
        bot=0;
    }
}
// 64 位输出请用 printf("%lld")

全部评论

相关推荐

Rena1ssance_:对的,要是面评没太烂,勤更新简历等捞就行了,腾讯可以无限复活
点赞 评论 收藏
分享
水墨不写bug:疑似没有上过大学
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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