AcWing 1216. 饮料换购
原题链接
简单
#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define INF 0x3f3f3f3f
#define endl "\n"
typedef unsigned long long ULL;
typedef pair<int,int> PII;
typedef long long LL;
const int N = 53;
int n,t;
void solve(){
while(cin >> n){
int ret = n;
while(n / 3){
ret += n / 3;
n = n / 3 + n % 3;
}
cout << ret << endl;
}
}
int main(){
#ifdef LOCAL
freopen(".w/ac.in","r",stdin);
freopen(".w/ac.out","w",stdout);
#endif
IOS;
int TT = 1;
// cin >> TT;
while(TT--) solve();
return 0;
}