[蓝桥杯][2015年第六届真题]饮料换购

水题。

int n;

int main()
{
    cin>>n;

    int res=n;
    int carry=0;
    while(n)
    {
        n+=carry;
        carry=n%3;
        n/=3;
        res+=n;
    }
    cout<<res<<endl;
    //system("pause");
    return 0;
}
原文地址:https://www.cnblogs.com/fxh0707/p/14571307.html