AcWing_1216 饮料换购(模拟)

AcWing

1216. 饮料换购

#include <bits/stdc++.h>
using namespace std;
int main(){
    int res, n; // 总瓶数,当前瓶盖数
    cin >> n;
    res = n;
    while(n >= 3){
        res += n / 3;
        n = n / 3 + n % 3;
    }
    cout << res;
    return 0;
}