题解 | #汽水瓶#

汽水瓶

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

#include <iostream>
using namespace std;

int main() {
    int n;

    while (cin >> n) {
        if (n == 0)
            break;
        int ans = 0;
        while (n >= 3) {
            ans += n / 3;
            n = n % 3 + (n / 3);
        }
        if (n == 2)
            ans++;

        cout << ans << endl;
    }
}
// 64 位输出请用 printf("%lld")

全部评论

相关推荐

Hyh_111:像这种hr就不用管了,基本没啥实力,换一个吧
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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